2014年2月8日
摘要: 深度克隆注意事项1.传参(如果参数为空时)2.事件名(如果突然事件名要重新命名时)function cloneObject(json){ if(json===null || arguments.length==0){//如果对象为空或者无参数时返回null return null; } var o=json.constructor===Array?[]:{};//判断参数是数组还是json(对象) for(var i in json){//循环对象进行复制 if(json.hasOwnProperty(i)){//当数组或者json(对象)有值的时候才进行克隆 o... 阅读全文
posted @ 2014-02-08 15:14 apple_半个苹果 阅读(168) 评论(0) 推荐(0) 编辑