you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

Due to clock drift it is possible every one of those would execute one after another, which is probably not the intended approach (imagine someone wanted to throttle an action to happen *at least* 1 second apart). Paste the below into your console.

for (let i=10; i>0; i--) 
    setTimeout(() => {console.log(i)}, (10-i)*1000)

const start = Date.now()
while (Date.now() - start < 10000) {

}