javascript - forEach 循环未正确循环
问题描述
我有以下代码:
array.forEach(function(x){
console.log("inside foreach")
const getData = async () => {
try {
const jsonValue = await AsyncStorage.getItem("item")
if(jsonValue != null){
console.log("not null")
}else{
console.log("null")
}
}
getData()
})
它不能正常工作,输出首先检索所有“内部 foreach”,然后检索其余部分。我该如何解决?谢谢!
解决方案
推荐阅读
- css - Bootstrap 3 Carousel 图像具有填充直到它们变为活动状态
- python - 在 django 中装了多少零或多,一或多,零或一?
- pickle - 如何腌制/序列化 swigpyobject?
- mysql - mysql安装程序没有配置mysql
- angular - 每次更改检测在组件级别运行时,有没有办法记录?
- php - 将活动 CSS 类添加到菜单项
- python - 如何打印文本每个句子中的前两个单词
- python - 不断收到 IDLE 内部异常 TypeError,但它没有告诉我问题出在哪里
- java - TextView的背景没有改变
- ios - Ionic 5 - ion-item 需要在 IOS 中点击 2 次才能触发 onclick 事件