其实javaScript里经常用到 copy,而copy又分deepcopy和 shallow copy。
deep copyvar deepCopy = function(o) { if (o instanceof Array) { var n = []; for (var i = 0; i < o.length; ++i) { n[i] = deepCopy(o[i]); } return n; } else if (o instanceof Object) { var n = {}; for (var i in o) { n[i] = deepCopy(o[i]); } return n; } else { return o; }};新闻热点
疑难解答