Reputation: 9
function person(name){
this.name1 = "His";
this.day = {};
this.day.time="kokok";
this.check = function(name){
for(var i in this) console.log(this["i"]);
if(this.name1===name) console.log("ready"+this.day.time);
};
}
var t= new person("His");
t.check("His");
Upvotes: 0
Views: 21
Reputation: 707328
It needs to be:
console.log(this[i]);
instead of:
console.log(this["i"]);
You want to reference the variable i
, not a string "i"
.
Upvotes: 1