Can anyone enlighten me, what is the difference between
hasOwnProperty and propertyIsEnumerable:
Simply stated:
hasOwnPropertywill return true if and only if the property is the property of the object and is not inherited. This one is simple.
and
propertyIsEnumerablewill return true if and only ifhasOwnPropertyreturns true and the property is enumerable. SopropertyIsEnumerableis one "additional requirement" on top of thehasOwnPropertytest, and the namepropertyIsEnumerablewould be more accurate if it ishasOwnPropertyAndIsEnumerable.
demo: http://jsfiddle.net/aby3k/