I'm trying to figure out why the following piece of code only pops the last 3 items off the array but not the last two.
var test = ['test1','test2','test3','test4','test5'];
console.log('length - '+test.length);
for(var k = 0; k <= test.length; k++) {
var tests = test.pop();
console.log(tests+' - '+k);
}
The results for the above code:
length - 5
(index):30 test5 - 0
(index):30 test4 - 1
(index):30 test3 - 2