Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/School-Work / School Work/Turn Objects into Flexible Arrays/page1.js |
| Date | Not specified in source |
| Repository | Janady13/School-Work |
| Revision | 4a666c890caf7c43c47d0572dbcc287373c7a78e |
| Branch | main |
| Path or archive member | School Work/Turn Objects into Flexible Arrays/page1.js |
| Original SHA-256 | 9be5e34f4f31a6da57d07f9687d91781da2c885218477cdf606802672410c097 |
| Git blob SHA | 2eb87fb39da970ad6fbb0bfbc5429f92a8ef2dda |
| Reading-copy SHA-256 | 9be5e34f4f31a6da57d07f9687d91781da2c885218477cdf606802672410c097 |
Recovered source transcript
Download complete source text ↓26 lines · 0.5 KB
// Object.entries give you the array of arrays. It is splitting up the arrays and giving them back to you.
const users = {
'2345234': {
name: "John",
age: 29
},
'8798129': {
name: "Jane",
age: 42
},
'1092384': {
name: "Fred",
age: 17
}
};
const usersOver20 = Object.entries(users).reduce((acc, [id, user]) => {
if(user.age > 20){
acc.push({...user, id})
}
return acc;
} , [])