Javascript – Why does this Node.js script produce different output each time?
This script is from a Nodejs introducing book. This part is about the event loop of Javascript. const sleep_st = (t) => new Promise((r) => setTimeout(r, t)); const sleep_im = () => new Promise((r) => setImmediate(r)); (async () => {…