在继续之前,我需要一个等待异步调用的循环.就像是:
for ( /* ... */ ) {
someFunction(param1, praram2, function(result) {
// Okay, for cycle could continue
})
}
alert("For cycle ended");
Run Code Online (Sandbox Code Playgroud)
我怎么能这样做?你有什么想法?
几分钟前我问过循环,请参阅JavaScript中的Asynchronous for cycle.
这一次,我的问题是 - Node.js有什么模块吗?
for ( /* ... */ ) {
// Wait! I need to finish this async function
someFunction(param1, praram2, function(result) {
// Okay, continue
})
}
alert("For cycle ended");
Run Code Online (Sandbox Code Playgroud) 如果我想要如何使用对象...
var object = { 'title': value };
alert( object[ /* Whatever */ ] ); // Should return 'title' NOT value
Run Code Online (Sandbox Code Playgroud)
谢谢.