I didn’t know and search on google, and end up with this
that they compare this model in this flavour
hasOwnProperty
with for..in
like
for ( var key in obj )
...obj.hasOwnProperty(key...
and with Object.keys
keys = Object.keys(obj);
for (i = 0, l = keys.length; i < l; i++)
...
This answer might solve “down the road”
.
.
.
When u do for..in
u transverse all enumerable properties, that is object’s own and inherited properties
and then u use in body of for..in
, hasOwnProperty
to check does that enumerable property is own
With Object.keys
u transverse just own enumerable properties
Found that Object.keys
are 50%+ faster then for..in