Why does this code run differently in browser and node environments?

  node.js, question

Code:

var arr = [{
 flag: 0
 }];
 var timer = null;
 
 function foo() {
 Arr[0].flag Plus = 0.125;
 console.log(arr);
 timer = setTimeout(foo, 500);
 bracket
 setTimeout(foo, 200);

Running results under node:

[ { flag: 0.125 } ]
 [ { flag: 0.25 } ]
 [ { flag: 0.375 } ]
 [ { flag: 0.5 } ]
 [ { flag: 0.625 } ]
 [ { flag: 0.75 } ]
 [ { flag: 0.875 } ]
 [ { flag: 1 } ]

Results of running on Chrome console:

[ { flag: 0.75 } ]
 [ { flag: 0.75 } ]
 [ { flag: 0.75 } ]
 [ { flag: 0.75 } ]
 //The output value of a single run is always the same, but the output value of multiple runs is different.

Node console is converted to string output.
In chome, replace withconsole.log(JSON.stringify(arr));Look again.