JS 克隆数据
function clone(obj){ var type = Object.prototype.toString.call(obj).slice(8,-1).toLowerCase(); if(type=='object'){ var json = {}; for(i in obj){ if(obj.hasOwnProperty(i)){ json[i] = clone(obj[i]); } } return json; }else if(type=='array'){ var arr = []; for(var i=0; i<obj.length; i++){ arr[i] = clone(obj[i]); } return arr; }else{ return obj; } }