当前位置 : 主页 > 网络编程 > JavaScript >

cocos2d-js 深拷贝.txt

来源:互联网 收集:自由互联 发布时间:2021-06-30
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
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(sObj[i]);
        }
        return s;
    };
网友评论