`Object.hasOwnProperty` already exists via the prototype chain, but I'm
guessing you wish it did something different.

Both the concern of `someObj.hasOwnProperty(somePropertyName)` attempting
to call the `hasOwnProperty` property of `someObj` rather than walking the
prototype chain to get `Object.prototype.hasOwnProperty`, and the concern
of `someObj` having a null prototype (or otherwise not having
`Object.prototype.hasOwnProperty` on its prototype chain) can be avoided
with the `{}.hasOwnProperty.call(someObj, somePropertyName)` pattern.

On Thu, May 26, 2016 at 12:26 PM, doodad-js Admin <[email protected]>
wrote:

> Hi,
>
>
>
> I think to create "Object.hasOwnProperty". Often, an object is used to
> store key/value pairs and most users forget that “hasOwnProperty” can be
> also be a key. Objects created by “Object.create(null)” don’t inherit this
> function and users get lost when they get such an object from a library or
> their own code.
>
>
>
> Claude Petit
>
>
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to