var extend=(function(){
for(var p in { toString:null}){
return function extend(o){
for(var i=1;i < arguments.length; i++ ){
var source = arguements[i];
for (var prop in source ) o[prop] = source[prop];
}
return o;
};
}
return function patched_extend(o){
for(var i = 1;i < arguments.length; i++){
var source = arguments[i];
for(var prop in source) o[prop] = source[prop];
for(var j = 0; j < protoprops.length;j++){
prop = protoprops[j];
if(source.hasOwnProperty(prop)) o[prop] = source[prop];
}
}
return o;
};
var protoprops = ["toString","valueOf","constructor","hasOwnProperty", "isPrototypeOf","propertyIsEnumerable","toLocaleString"]
;}());
我觉得这个patched_extend访问不到protoprops诶 所以
for(var j = 0; j < protoprops.length;j++){
prop = protoprops[j];
if(source.hasOwnProperty(prop)) o[prop] = source[prop];
}
这段白写或者 protoprops位置写错了
求教!!
for(var p in { toString:null}){
return function extend(o){
for(var i=1;i < arguments.length; i++ ){
var source = arguements[i];
for (var prop in source ) o[prop] = source[prop];
}
return o;
};
}
return function patched_extend(o){
for(var i = 1;i < arguments.length; i++){
var source = arguments[i];
for(var prop in source) o[prop] = source[prop];
for(var j = 0; j < protoprops.length;j++){
prop = protoprops[j];
if(source.hasOwnProperty(prop)) o[prop] = source[prop];
}
}
return o;
};
var protoprops = ["toString","valueOf","constructor","hasOwnProperty", "isPrototypeOf","propertyIsEnumerable","toLocaleString"]
;}());
我觉得这个patched_extend访问不到protoprops诶 所以
for(var j = 0; j < protoprops.length;j++){
prop = protoprops[j];
if(source.hasOwnProperty(prop)) o[prop] = source[prop];
}
这段白写或者 protoprops位置写错了
求教!!