JS: List Properties

By Xah Lee. Date: . Last updated: .

To list properties of a object, use one of the following methods. Which one to use depends on if you want enumerable keys only, and or including symbol keys.

Properties to Array
syntaxmeaningproto chainenumerable onlyinclude symbol keyinclude string key
Object.keys(o) [see JS: Object.keys] noyesnoyes
Object. getOwnPropertyNames(o) [see JS: Object.getOwnPropertyNames] nononoyes
Object. getOwnPropertySymbols(o) [see JS: Object.getOwnPropertySymbols] nonoyesno
Reflect.ownKeys(o) [see JS: Reflect.ownKeys] nonoyesyes

[see JS: Property Attributes, writable, enumerable, configurable]

Array-Like Object to Array

[see JS: Array-Like Object to Array]

Iterable Object to Array

If the object is iterable, use:


[see JS: Array.from]

[see JS: Iterable]

JS Array

  1. Understand JS Array
  2. Create Array
  3. Sparse Array
  4. Array-Like Object
  5. Array How-To
  6. Array Object
  7. Array.prototype

JS Object Property

  1. Property Overview
  2. Property Key
  3. Dot vs Bracket Notation
  4. Create/Delete Property
  5. Get/Set Property
  6. Check Property Existence
  7. Access Property
  8. List Properties
  9. Property Attributes
  10. Getter/Setter
  11. Property Descriptor
  12. Symbol
Liket it? Put $5 at patreon.

Or, Buy JavaScript in Depth

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

Web Dev Tutorials

  1. HTML
  2. Visual CSS
  3. JS in Depth
  4. JS Reference
  5. DOM
  6. SVG
  7. Web Dev Blog