Here i created an instance of parent class and defined a property called smile on the object itself. I know that the property defined on constructor's prototype is not the object's own property .But how come "smile" property have not passed the hasOwnProperty test inside for in loop?
function Parent(){
this.name='parent';
}
Parent.prototype.age='34';
var p=new Parent();
p.smile='nice'; // not an own property ?
console.log(p);
for(var prop in p){
if(Object.hasOwnProperty(prop)){
console.log(prop); // prints only "name"
}
}