/ Published in: JavaScript
URL: http://my.opera.com/GreyWyvern/blog/show.dml/1725165
Expand |
Embed | Plain Text
Object.prototype.clone = function() { var newObj = (this instanceof Array) ? [] : {}; for (i in this) { if (i == 'clone') continue; if (this[i] && typeof this[i] == "object") { newObj[i] = this[i].clone(); } else newObj[i] = this[i] } return newObj; };
You need to login to post a comment.
