I have an object p, with an enumerable propery x.
var p = Object.create(Object.prototype, {
x: {
value: "frog",
enumerable: true
}
});
I create an object, that inherits from p, and overrides property x, with a non-enumerable property
var o = Object.create(p, {
x: {
value: "bird",
enumerable: false
}
});
What do you think, will the property x be enumerated in a for...in loop of o?
for (var n in o) {
console.log(n);
}
Well, in Chrome and IE9 it will be enumerated (which is, I think, quite wierd); in FF, it won't be enumerated.
Which one is the right behaviour?
Here is a complete example: http://jsfiddle.net/hnvsM/3/