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.keysnoyesnoyes
Object. getOwnPropertyNames(o) 〔►see JS: Object.getOwnPropertyNamesnononoyes
Object. getOwnPropertySymbols(o) 〔►see JS: Object.getOwnPropertySymbolsnonoyesno
Reflect.ownKeys(o) 〔►see JS: Reflect.ownKeysnonoyesyes

〔►see JS: Property Attributes

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

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

  1. JS: Array Object
  2. JS: Array.prototype
Like what you read? Buy JavaScript in Depth