js实现clone
function clone(obj){ if(obj instanceof Array){ var buf=[]; var i=obj.length; while(i--){ buf[i]=arguments.callee(obj[i]);//递归调用,直到最后为基本数据类型; } return buf; }else if(obj instanceof object){ var buf={}; for(var e in obj){ buf[e]=arguments.callee(obj[e]); } return buf; }else{ return obj; } }