CodePlumage pfp
CodePlumage
@web3knight
Can you answer?โ˜บ๏ธ โ˜บ๏ธ What is the result of below code? const promise = new Promise((resolve, reject) => { console.log(1); setTimeout(() => { console.log("timerStart"); resolve("success"); console.log("timerEnd"); }, 0); console.log(2); }); promise.then((res) => { console.log(res); }); console.log(4);
1 reply
0 recast
1 reaction

jazzycat pfp
jazzycat
@crazydraco
omg this is interesting! the order is 1, 2, 4, timerStart, success, timerEnd ๐Ÿ™Œ
0 reply
0 recast
0 reaction