Coderbyte

PHOTO EMBED

Sat Dec 02 2023 09:15:49 GMT+0000 (Coordinated Universal Time)

Saved by @yash89

What will the following JavaScript code output?


for (var i = 0; i < 3; i++) {

  setTimeout(function() { alert(i); }, 1000 + i);

}
content_copyCOPY

https://coderbyte.com/candidate-assessment#submitted_code_solution