0

function x(){ for(var i = 1; i<=5; i++) { setTimeout(function (){ console.log(i); }, i * 1000); }

What is the output?

8th Dec 2020, 6:21 AM
harsh tiwari
harsh tiwari - avatar
3 Answers
+ 2
Similar problem, if you seek explanation https://www.sololearn.com/Discuss/2617149/?ref=app
8th Dec 2020, 6:48 AM
Ipang
0
Tell me output
8th Dec 2020, 6:34 AM
harsh tiwari
harsh tiwari - avatar
0
harsh tiwari if you just want the output, you can run it yourself in the Code Playground. You don't need to ask a question for that. If you want to know the reason for why the output is like that, then Rei already linked a webpage in his answer.
8th Dec 2020, 6:40 AM
XXX
XXX - avatar