cycold / cycold.github.io

Please dot not star...
4 stars 1 forks source link

Promise then 异步执行 #160

Closed cycold closed 6 years ago

cycold commented 6 years ago

https://stackoverflow.com/questions/48733021/is-promise-resolve-a-asynchronous-function

console.log("Code starts here");
setTimeout(console.log,0,"setTimeout resolved");
Promise.resolve("promise resolved")
       .then(s => (console.log(s), "yet another promise resolved"))
       .then(s => console.log(s));
console.log("Code ends here")