-
-
Save GustiCup/033b0aa436a19197b8659cfdabb5056f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const myUsers = [ | |
{ name: 'chris', likes: 'chicken' }, | |
{ name: 'guus', likes: 'beer' }, | |
{ name: 'marielle', likes: 'biscuits' } | |
] | |
const usersByFood = myUsers.map(item => { | |
const container = {}; | |
container[item.name] = item.likes; | |
container.age = item.name.length * 10; | |
return container; | |
}) | |
console.log(usersByFood); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment