cocos2d-js 深拷贝.txt jsclient.deepClone = function(sObj) { if (typeof(sObj) !== "object") { return sObj; } var s = {}; if (sObj.constructor == Array) { s = []; } for (var i in sObj) { s[i] = jsclient.deepClone(sObj[i]); //Object.clone(s
jsclient.deepClone = function(sObj) { if (typeof(sObj) !== "object") { return sObj; } var s = {}; if (sObj.constructor == Array) { s = []; } for (var i in sObj) { s[i] = jsclient.deepClone(sObj[i]); //Object.clone(sObj[i]); } return s; };