This is probably a vary noob question, but I cannot figure out what is happening. I have a simple function that I run:
function f() {
var x = [{a:1, b: 2}, {a: 3, b: 4}];
console.log(x);
x.push({a: 5, b: 6});
console.log(x);
f();
The two console.log outputs show the same thing with all three elements which I cannot understand. If I change function so that the array only contains numbers:
function f() {
var x = [1, 2];
console.log(x);
x.push(3);
console.log(x);
f();
then the outputs looks as I would have expected with the first one showing a list with items 1,2 and the second showing a list with 1,2,3.
This all runs in Firefox.