sorry by question but i'm not so very well in JavaScript, and I searched but did not find the answert, I hope you'll help me. I have this code
var obj = {
var1:[],
var2:[],
set1: function(){
this.var1.push(1);
},
set2 : function(){
this.var2 = this.var1;
}
};
obj.set1();
obj.set2();
obj.set1();
console.log(obj.var2);
I think that in console will be [1], but the correct is [1,1] Question is How to set var2 in set2 to have [1] in console. I think that this.var2 = this.var1; is the reference, but I realy need to set var2 to var1