Skip to content

Instantly share code, notes, and snippets.

@OtavioBraga
Created June 9, 2018 00:28
Show Gist options
  • Save OtavioBraga/6866b22ad12137b9a9fdb8b618156565 to your computer and use it in GitHub Desktop.
Save OtavioBraga/6866b22ad12137b9a9fdb8b618156565 to your computer and use it in GitHub Desktop.
const users = [
{
id: 1,
name: "Allan",
age: 27,
profilePicture: "http://…",
city: "São Paulo"
},
{
id: 2,
name: "Julie",
age: 29,
profilePicture: "http://…",
city: "Curitiba"
},
{
id: 3,
name: "Pedro",
age: 31,
profilePicture: "http://…",
city: "Rio de Janeiro"
}
]
const names = users.map(user => user.name)
console.log(names)
// ["Allan","Julie","Pedro"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment