I have a class in json format. I would like to make two examples. Right now (it’s pretty obvious why), when I create two objects, I really have 2 vars pointing to one. (b.blah = 'z' will do a.blah == 'z')
How to make a copy of an object?
var template = {
blah: 0,
init: function (storageObj) {
blah = storageObj;
return this;
},
func2: function (tagElement) {
},
}
a = template.init($('form [name=data]').eq(0));
b = template.init($('form [name=data2]').eq(0));
user34537
source
share