JS: Object Properties to Array
Object Properties to Array
- To list properties of a object, use one of the following methods.
- They return a Array or Iterable. Then you can loop over them
Method | include non-Enumerable keys | include Symbol key | include string key |
---|---|---|---|
Object.keys | no | no | ✅ |
Object.values | no | no | ✅ |
Object.entries | no | no | ✅ |
Object.getOwnPropertyNames | ✅ | no | ✅ |
Object.getOwnPropertySymbols | ✅ | ✅ | no |
Reflect.ownKeys | ✅ | ✅ | ✅ |
Array-Like Object to Array
Iterable Object to Array
Loop Over Enumerate Properties Over Prototype Chain
syntax | use proto chain | include non-Enumerable keys | include Symbol Key | include string key |
---|---|---|---|---|
for-in Loop | ✅ | no | no | ✅ |
JavaScript, Property
- JS: Property Overview
- JS: Order of Properties
- JS: Property Key
- JS: Property Dot Notation vs Bracket Notation
- JS: Create Property
- JS: Delete Property
- JS: Get Set Property
- JS: Check Property Existence
- JS: Access Property
- JS: Object Properties to Array
- JS: for-in Loop 👎
- JS: Enumerable Property
- JS: Property Attributes
- JS: Property Descriptor
- JS: Getter Setter Properties