Watch.JS icon indicating copy to clipboard operation
Watch.JS copied to clipboard

Class instance new properties

Open LMnet opened this issue 11 years ago • 1 comments

Look at this fiddle: http://jsfiddle.net/tYRn5/ It fails on 11 line. I found, that problem occurs in clone function, on line 100:

var copy = obj.constructor();

In case of class instance, it must be something like this:

var copy = new obj.constructor();

LMnet avatar Nov 21 '13 08:11 LMnet

Just for adding some considerations, look at this stackoverflow post on how to clone an object: http://stackoverflow.com/a/728694

"To do this for any object in JavaScript will not be simple or straightforward."

Maluen avatar Nov 21 '13 18:11 Maluen