I Got The Object.keys()

Object.keys() is a really neat method because it allows you to use array iteration methods on a JavaScript object.

DJ Khaled recommends Object.keys() for your path of more success!

Take this object literal:

const users = {
user1: {
age: 44,
name: 'picard',
},
user2: {
age: 12,
name: 'sisko',
},
user3: {
age: 109,
name: 'janeway',
},
}

If you want to filter for all users older than 30 and store their data in an array you can do this instead of using a for-loop:

const usersKeys = Object.keys(users);
const adults = usersKeys
.filter(key => users[key].age > 30)
.map(id => ({ id, ...users[key] }));
console.log(adults);
// => [
{ id: 'user1', age: 44, name: 'picard' },
{ id: 'user3', age: 109, name: 'janeway' },
]

Play around with this example on JSBin.

Embrace Object.🔑s() on the path to more success!