让我们说:
Foo.user = Ember.Object.extend({
username:null,
name:null,
loadData:function(data){
_.each(data, function(value, key){
console.log(this.hasOwnProperty(String(key)), key, String(key));
console.log((String(key) in this));
console.log(key in this.__proto__);
console.log(_.has(this, key));
...
});
},
})
数据是对象ex。 JSON
是否有任何Ember测试方式或只是JS OO方式?
是的,它是下划线......;)
答案 0 :(得分:0)
好的,背景错误,道歉......我很糟糕。
Foo.user = Ember.Object.extend({
username:null,
name:null,
loadData:function(data){
_.each(data, function(value, key){
console.log(this.hasOwnProperty(String(key)), key, String(key));
console.log((String(key) in this));
console.log(key in this.__proto__);
console.log(_.has(this, key));
...
}, this);
},
})