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

In ES5 I would have solved the second problem like this:

var arr = [10, 12, 15, 21];
for (var i = 0; i < arr.length; i++) {
setTimeout(function(index) {
console.log('The index of this number is: ' + index);
}.bind(i), 3000);
}

And also the third problem looks to me like delaying a 10000 callbacks and not decrement the number of callback execution. Am I wrong?

Show your support

Clapping shows how much you appreciated Andrea Silvestri’s story.