84563376 2019-06-29
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 :)