js 深拷貝的幾種方法

// js深拷貝方法 var obj = { a:1, arr:[1,2], name:「中國」, area:[‘北京’,‘上海’,‘廣州’] } var obj2 ={test:「obj2」} obj2=deepCopy(obj,obj2); function deepCopy(o,c){ var c =c || {}; for(let i in o){ // 判斷對象的屬性是一個對象 if(t
相關文章
相關標籤/搜索