编辑代码





var c = {
    a: {
        c: "1"
    }
};


function deepClone(a, b) {
    for (p in b) {
        if (b.hasOwnProperty(p)) {
            if (typeof b[p] == "object") {
                a[p]=b[p] instanceof "Array"?[]:{}
                deepClone(a[p], b[p]);
            } else {
                a[p] = b[p];
            }
        }
    }
}



var d = {};

deepClone(d, c);

console.log(d);