You often need to look through the properties and values of plain JavaScript objects.
Here are the common lists to extract from an object:
Let’s consider the following JavaScript object:
const hero = {
name: 'Batman',
city: 'Gotham'
};
The keys of hero
are ['name', 'city']
. The values are ['Batman', 'Gotham']
. And the entries are [['name', 'Batman'], ['city', 'Gotham']]
.
Let’s see what utility functions provide JavaScript to extract the keys, values, and entries from an object.
#javascript #object