Skip to content

Instantly share code, notes, and snippets.

@GustiCup
Last active November 1, 2018 15:01
Show Gist options
  • Save GustiCup/033b0aa436a19197b8659cfdabb5056f to your computer and use it in GitHub Desktop.
Save GustiCup/033b0aa436a19197b8659cfdabb5056f to your computer and use it in GitHub Desktop.
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