DEV Community

Sham Gurav
Sham Gurav

Posted on

 

Guess the Output ??? #1

for (var i = 0; i < 3; i++) {
     setTimeout(() => console.log(i), i * 1000);
}
Enter fullscreen mode Exit fullscreen mode

Options : -

A) 0, 1, 2
B) 1, 2, 3
C) 0, 0, 0
D) 3, 3, 3

Comment with correct answer.

Top comments (0)

This post blew up on DEV in 2020:

js visualized

🚀⚙️ JavaScript Visualized: the JavaScript Engine

As JavaScript devs, we usually don't have to deal with compilers ourselves. However, it's definitely good to know the basics of the JavaScript engine and see how it handles our human-friendly JS code, and turns it into something machines understand! 🥳

Happy coding!