728x90
let john = { name: "John", surname: "Smith", id: 1 };
let pete = { name: "Pete", surname: "Hunt", id: 2 };
let mary = { name: "Mary", surname: "Key", id: 3 };
let users = [ john, pete, mary ];
let usersMapped = /* ... your code ... */
/*
usersMapped = [
{ fullName: "John Smith", id: 1 },
{ fullName: "Pete Hunt", id: 2 },
{ fullName: "Mary Key", id: 3 }
]
*/
alert( usersMapped[0].id ) // 1
alert( usersMapped[0].fullName ) // John Smith
'Algorithm > JavaScript(Node.js)' 카테고리의 다른 글
The Modern JS Tutorial: array-methods: shuffle an array (0) | 2021.09.21 |
---|---|
The Modern JS Tutorial: array-methods: sort users by age (0) | 2021.09.20 |
The Modern JS Tutorial: array-methods: map to names (0) | 2021.09.20 |
The Modern JS Tutorial: array-methods: calculator (0) | 2021.09.20 |
The Modern JS Tutorial: array-methods: filterRangeInPlace (0) | 2021.09.13 |