时间:2021-07-01 10:21:17 帮助过:45人阅读
function objectClone(obj,preventName){ if((typeof obj)=='object'){ var res=(!obj.sort)?{}:[]; for(var i in obj){ if(i!=preventName) res[i]=objectClone(obj[i],preventName); } return res; }else if((typeof obj)=='function'){ return (new obj()).constructor; } return obj; }
更多js 深拷贝函数相关文章请关注PHP中文网!