mediumStudy question · answer published in Node.js interview questions, so no pointsstacks-and-queuesjavascript
Promise callback versus setTimeout order
In Node.js or a browser, what does this code print?
console.log(1) setTimeout(() => console.log(2), 0) Promise.resolve().then(() => console.log(3)) console.log(4)
Discussion 0
Join free to post in the discussion.
Related questions
- fetch treats a 404 as successBackend Developer
- slice vs spliceBackend Developer
- indexOf and NaNBackend Developer
- new Array(3) then mapBackend Developer
- Value missing from indexOfBackend Developer
- parseInt on a CSS valueBackend Developer
- Number of an empty form fieldBackend Developer
- Checking whether a value is an arrayBackend Developer