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]

Array Topic

  1. JS: Array Basics
  2. JS: Understand JS Array
  3. JS: Create Array
  4. JS: Sparse Array
  5. JS: Array-Like Object
  6. JS: Array How-To
  7. JS: Array Object
  8. JS: 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 Basics
  4. JS in Depth
  5. JS Reference
  6. DOM
  7. SVG
  8. JS Misc