What am i missing here? Cant get it why my console behaves differently depending on either while loop is there or not?
function findPath(){
var openArr = [];
var closeArr = [];
var morefun = {};
var morefun1 = {};
var morefun2 = {};
morefun.f = 1;
morefun1.f = 2;
morefun2.f = 3;
openArr.push(morefun1);
openArr.push(morefun2);
openArr.push(morefun);
console.log(Array.isArray(openArr));
console.log(openArr);
console.log(openArr.length);
while (openArr.length){
var current = openArr.pop();
closeArr.push(current);
}
}
findPath();
Im getting from console.log(openArr)
[Object, Object,Object]
length: 0 // when while loop is there.
And getting
[Object, Object,Object]
0:Object
1:Object
2:Object
length:3 // without while loop
It doesent seem to be Chrome only thing as my Firefox console shows similar results - when i click on an array for details i get length:0 with loop and length:3 w/o. Am i missing smth with execution order?