+ 2
Why? As far I know pop remove last element.
var arr =[1,2,3,4,5]; for( var i=0; i < arr.length ; i++){ console.log(arr.pop()); } // 543
2 Answers
0
So what do you think is happening here?it is working as it should be but I would like to know what you don't understand đ€
0
popping elements changes the length of the array and i < arr.length becomes false, before you get to 2.