function clone(obj){ // 该函数返回一个对象的深度复制的副本
...........code............ return objClone;
}function objectInfo(){
var cloneObj = clone(this); ......... code ............. this = cloneObj; //error 很显然不能直接对this赋值. 除了for in循环.给this各属性赋值外.有别的办法吗? // for(var p in cloneObj){
// this[p] = cloneObj[p];
// }
}
function clone(obj){ // 该函数返回一个对象的深度复制的副本
...........code............ return objClone;
}function objectInfo(){
this.f = function(){
var cloneObj = clone(this); ......... code ............. this = cloneObj; /* error 很显然不能直接对this赋值. 除了for in循环.给this各属性赋值外.有别的办法吗? */ // for(var p in cloneObj){
// this[p] = cloneObj[p];
// }
}
//...........code............ return objClone;
}function objectInfo(obj){
this.init = function(){
if(obj==null)
return this;
else
return clone(obj);
}
//......... code .............
return this.init;
}