function copy(arr) { var obj = arr.construcrot === Array?[]:{}; for(var item in arr) { if(typeof arr[item] === 'Object') { obj[item] = copy(arr[item]); }else { obj[item] = arr[item]; } } return obj; } var arr = { "a":1, "b":2, "c":3 } console.log(arr.a); var brr = copy(arr); brr.a = 2; console.log(brr.a);