hasOwnProperty vs propertyIsEnumerable
Kann mich jemand aufklären, was der Unterschied zwischen hasOwnProperty und propertyIsEnumerable ist:
function f(){
this.a = 1;
this.b = 2;
this.c = function(){}
}
f.prototype = {
d : 3,
e : 4,
g : function(){}
}
Erstellen der Instanz eines Objekts:
var o = new f();
Und hier kann ich keinen Unterschied sehen. Meiner Meinung nach machen sie dasselbe
o.hasOwnProperty('a'); //true
o.hasOwnProperty('b'); //true
o.hasOwnProperty('c'); //true
o.hasOwnProperty('d'); //false
o.hasOwnProperty('e'); //false
o.hasOwnProperty('g'); //false
o.propertyIsEnumerable('a'); //true
o.propertyIsEnumerable('b'); //true
o.propertyIsEnumerable('c'); //true
o.propertyIsEnumerable('d'); //false
o.propertyIsEnumerable('e'); //false
o.propertyIsEnumerable('g'); //false
Richtig, wenn ich falsch liege