Question: What will the following JavaScript code output? for ( var i = 0 ; i 3 ; i + + ) { setTirecut ( function

What will the following JavaScript code output?
for (var i =0; i 3; i++){
setTirecut(function(){ alert(i); },1000+ i);
}
Number 0 alerted 3 times
Number 3 alerted three times
Numbers 1,2,3 alerted
undefined
What will the following JavaScript code output?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!