201612020940——《Javascript深拷贝》
//对象深拷贝 function deepcopy (obj,newobj) { var newobj = newobj || {}; for (var i in obj) { if (typeof obj[i] == "object") { newobj[i]=(obj[i].constructor === Array)?[]:{}; deepcopy(obj[i],newobj[i]); }else{ newobj[i]=obj[i]; } } return newobj; };
学习Js是一条长路,不能仅仅限于网页动效
前端-语言