網(wǎng)站公告:
咨詢(xún)熱線:0755-23316625

產(chǎn)品信息

聯(lián)系我們

聯(lián)系人:張先生
手機(jī):0755-23316625
電話:0755-23316625
傳真:0755-23316625
郵件:306074281@qq,com
郵政編碼:518000
網(wǎng)址:http://labo0.com
地址:深圳市龍華區(qū)觀湖街道茂源工業(yè)區(qū)A棟401
var obj = {a:10}; function copy(obj){ var newobj = {}; for ( var attr in obj) { newobj[attr] = obj[attr]; } return newobj; } var obj2 = copy(obj); obj2.a = 20; alert(obj.a); //10 var obj = {a:{b:10}}; function copy(obj){ var newobj = {}; for ( var attr in obj) { newobj[attr] = obj[attr]; } return newobj; } var obj2 = copy(obj); obj2.a.b = 20; alert(obj.a.b); //20 var obj = {a:{b:10}}; function deepCopy(obj){ if(typeof obj != 'object'){ return obj; } var newobj = {}; for ( var attr in obj) { newobj[attr] = deepCopy(obj[attr]); } return newobj; } var obj2 = deepCopy(obj); obj2.a.b = 20; alert(obj.a.b); //10