标签:value length array i++ function cti arguments [] string
var common = {
id: (new Date()).valueOf()
}
//数据深复制
common.deepCopy = 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 = json.length;
for (i = 0; i < len; i++) {
newArr[i] = arguments.callee(json[i]);
}
return newArr;
} else {
var newObj = {};
for (var name in json) {
newObj[name] = arguments.callee(json[name]);
}
return newObj;
}
}
}
标签:value length array i++ function cti arguments [] string
原文地址:http://www.cnblogs.com/saxibuni/p/6367252.html