3 JavaScript questions to watch out for during coding interviews
Daniel Borowski
1.4K29

2nd example can be nicely written in ES2015:

const arr = [10, 12, 15, 21]
arr.map((i,k) => setTimeout(_ => console.log(`Index ${k}`), 3000))

That example does exactly the same thing and is one-liner :)