如何在javascript中实现深度克隆
JSON.parse(JSON.stringify(o))
$.extend(true, {}, o)
.cloneNode
node.js
var o = (function() { var magic = 42; var magicContainer = function() { this.get = function() { return magic; }; this.set = function(i) { magic = i; }; } return new magicContainer;}());var n = clone(o); // how to implement clone to support closures
o
慕妹3146593
胡说叔叔
相关分类