setTimeout(() => {
console.log('I am the last one')
}, 0);
function count () {
for (var i = 0; i < 5; i++) {
((i) => setTimeout(() => console.log(i), 1000 * i))(i)
}
}
(async () => {
console.log('Let\'s count')
await count()
await 1;
console.log('What are you doing? ')
})()
Promise.resolve().then(async () => {
await new Promise((resolve) => {
console.log('I am in a nest promise')
resolve(
(() => setTimeout(() => Promise.resolve('Do you think I will get there? ').then(res => {
console.log(res)
}), 0))()
)
}).then(() => {
console.log('Absolutely')
})
})
console.log('Script start')
setTimeout(() => {
console.log('Script end')
}, 2000)
What about your answer :)
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。