请问下面的样例代码中,resolve,reject这俩函数的定义在哪?newPromise(function(resolve,reject){log('startnewPromise...');vartimeOut=Math.random()*2;log('settimeoutto:'+timeOut+'seconds.');setTimeout(function(){if(timeOut<1){log('callresolve()...');resolve('200OK');}else{log('callreject()...');reject('timeoutin'+timeOut+'seconds.');}},timeOut*1000);}).then(function(r){log('Done:'+r);}).catch(function(reason){log('Failed:'+reason);});
慕的地10843
相关分类