#Js
#javascript
#Trick
Object.keys, values, entries
These methods are generic, there is a common agreement to use them for data structures. If we ever create a data structure of our own, we should implement them too.
They are supported for:
Map
Set
Array
https://javascript.info/keys-values-entries
@fullStackDevs
#javascript
#Trick
Object.keys, values, entries
These methods are generic, there is a common agreement to use them for data structures. If we ever create a data structure of our own, we should implement them too.
They are supported for:
Map
Set
Array
Object.keys(obj) – returns an array of keys.
Object.values(obj) – returns an array of values.
Object.entries(obj) – returns an array of [key, value] pairs.
https://javascript.info/keys-values-entries
@fullStackDevs
👍1