not a js expert so this might be a stupid question but...
Why does the log show that the array has changed? I was expecting the array still to be a [0,0] since the method is invoked after the console.log. Also, if I try to replace the whole array like this:
this.my_array = [1,0];
the log will still show [0,0], which is something that makes more sense to me. What's going on?
function Y() {
this.my_array = [0,0];
this.changeIt = function() {
this.my_array[0] = 1;
};
}
var z = new Y;
console.log(z.my_array);
z.changeIt();
[0,0]when I run this in the commandline (Firebug).