有没有办法以不包含在循环中的方式将函数添加到对象原型?
前任:
Object.prototype.stuff = function(){};
var obj = {'hello':1};
for(var i in obj){
console.log(i);
}
//it will log: hello, stuff
//I'd want it to only log hello,
有没有办法以不包含在循环中的方式将函数添加到对象原型?
前任:
Object.prototype.stuff = function(){};
var obj = {'hello':1};
for(var i in obj){
console.log(i);
}
//it will log: hello, stuff
//I'd want it to only log hello,