JS: Check Property Existence

By Xah Lee. Date: . Last updated: .

Check If a Object Has Own Property

obj.hasOwnProperty(key)

[see JS: Object.prototype.hasOwnProperty]

Check If a Property is in Prototype Chain

To check if a property key is in a object obj's prototype chain (including if it's its own property), use one of:

JS Object Property Topic

  1. JS: Property Overview
  2. JS: Property Key
  3. JS: Property Dot Notation / Bracket Notation
  4. JS: Create/Delete Property
  5. JS: Get Property, Set Property
  6. JS: Check Property Existence
  7. JS: Access Property
  8. JS: Property Attributes, writable, enumerable, configurable
  9. JS: Getter/Setter Properties
  10. JS: Property Descriptor
Liket it? Put $5 at patreon.

Or, Buy JavaScript in Depth

If you have a question, put $5 at patreon and message me.