hasOwnProperty vs propertyIsEnumerable
Alguém pode me esclarecer, qual é a diferença entre hasOwnProperty e propertyIsEnumerable:
function f(){
this.a = 1;
this.b = 2;
this.c = function(){}
}
f.prototype = {
d : 3,
e : 4,
g : function(){}
}
criando a instância de um objeto:
var o = new f();
E aqui não vejo diferença. Na minha opinião eles estão fazendo a mesma coisa
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
Certo, se eu estiver errado