据说node7.0已经支持async/await,那么下面的代码为什么运行不了?
var sleep=function(time){
return new Promise(function(resolve,reject){
setTimeout(function(){
resolve('ok');
},time);
});
};
async function start(){
let result =await sleep(3000);
console.log(result);
}
start();Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
https://nodejs.org/en/docs/es6/