Hello! group. I'm having a trouble while scripting,when applying poo in a javascript viewpoint. This is a minor approach to my class: function Test( ){};
Test.prototype.$field = []; Let's suppose this class has only a field, that field is an array, let's then create two objects, a and b accordingly: $a = new Test();
$b = new Test(); Printing the fields, nothing seems odd still: console.log($a.$field); // Prints []
console.log($b.$field); // Prints [] Loading an array inside the first position of the first object causes the second object to be populated with same data: $a.$field[0] = ["a", "b", "c"];
console.log($b.$field); // Prints ["a", "b", "c"] This does not happen if the assigned value is not an array: $a.$field[0] = "Test";
console.log($b.$field[0]); // Prints undefined I'm using Google Chrome, Linux, Ubuntu 12.10, maybe the trouble could be my os version, or my computer itself (in case this were a bug), if it is a feature, i honestly don't understand it. I am interested on having it working on a Google Chrome, if someone can have it working then i can guess a solution depending on the context. Thanks in advance, and sorry my english, in case.