When you copy an object or pass it to a function, you only pass a reference to that object. If you make a change to the reference, it will modify the original object.
In the below example assigning an object to another variable and then make a change to the copy results in the change of the original object.
var original = {howmany: 1};
var copy = original;
copy.howmany
1
copy.howmany = 100;
100
original.howmany
100The same thing applies when passing objects to functions.
var original = {howmany: 100};
var nullify = function(o) {o.howmany = 0;}
nullify(original);
original.howmany
0