javascript - console.log/console.dir showing last state of object, not current -


i want log how array/object changing new steps of loop. console.log bad. shows last state of object everywhere. example:

var = {}; console.log(a); // {bob1: 0, bob2: 0} a.bob1 = 0; console.log(a); // {bob1: 0, bob2: 0} a.bob2 = 0; console.log(a); // {bob1: 0, bob2: 0} 

i found there, on so, command: console.dir. working in same example. shows states of object correcly.

look example. command works perfect: http://jsfiddle.net/rlzvv/

now, code pls. output in console. http://jsfiddle.net/3bds7/4/

this astar algorithm. take on part (neighbor 3 loop <--- neighbor 3 start ---> code situated here <--- neighbor 3 stop -->) in console. lanes, output console 105-113:

new openset length: 2 openset after adding new vertex **shows 1 element, length 2** 

it shows length 2, shows 1 element. but! seems me algo working correctly (it popping element, hidden on step after). why bug appears? did did wrong? seems me, everywhere last state of array shown, not current:( me please.

that's known issue -- sounds running under chrome.

the easiest work-around json encode value log in.

console.log(json.stringify(a)); 

Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -