标签:star code 面试题 tar sync await rom cti 事件
异步相关
1 // 今日头条面试题 2 async function async1() { 3 console.log(‘async1 start‘) 4 await async2() 5 console.log(‘async1 end‘) 6 } 7 async function async2() { 8 console.log(‘async2‘) 9 } 10 console.log(‘script start‘) 11 setTimeout(function () { 12 console.log(‘settimeout‘) 13 }) 14 async1() 15 new Promise(function (resolve) { 16 console.log(‘promise1‘) 17 resolve() 18 }).then(function () { 19 console.log(‘promise2‘) 20 }) 21 console.log(‘script end‘)
标签:star code 面试题 tar sync await rom cti 事件
原文地址:https://www.cnblogs.com/wangtingnoblog/p/10408936.html