I'm executing the following code via an onclick
event on my `LINK:
function myFunc() {
let foo = [];
console.log(foo);
foo.push({
'bar': 'baz',
});
return foo;
}
While I'd expect that the console.log
in Chrome outputs an empty array, it's already outputting my final variable:
0: {bar: "baz"}
length: 1
Any idea why this is happening?