复制js对象方法
需要的朋友可以参考下
复制代码 代码如下:
CSSCommonJSDeepCopy = function (json) {
if (typeof json == number || typeof json == string || typeof json == boolean) {
return json;
} else if (typeof json == object) {
if (json instanceof Array) {
var newArr = [] i len = jsonlength;
for (i = ; i < len; i++) {
newArr[i] = argumentscallee(json[i]);
}
return newArr;
} else {
var newObj = {};
for (var name in json) {
newObj[name] = argumentscallee(json[name]);
}
return newObj;
}
}
}