+ 1

Could you please explain why this code outputs 13. Thank you!

var arr = []; var x = 80 % 41; var y = 0; for ( var i = 0; i < 0; i++ ) if (i % 3 === 0) y = arr.push(i); document.write(y);

17th Mar 2018, 8:26 PM
Briaה‎
2 ответов
+ 5
It doesn't even run as you are using I instead of i and get a compile error. After fixing that, it outputs 0 as the loop isn't entered so y never changes.
17th Mar 2018, 8:39 PM
John Wells
John Wells - avatar
0
this code does not look like it is the code you think you were running....
17th Mar 2018, 8:33 PM
ifl
ifl - avatar