Created
August 7, 2018 09:29
-
-
Save rxluz/e28c4cede05edc52e50de64835ae9166 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 people = [ | |
{ | |
name: "Joseph", | |
age: 32, | |
gender: "male", | |
}, | |
{ | |
name: "Anna", | |
age: 27, | |
gender: "female", | |
}, | |
{ | |
name: "Patrick", | |
age: 31, | |
gender: "male", | |
}, | |
{ | |
name: "Ricardo", | |
age: 32, | |
gender: "male", | |
}, | |
{ | |
name: "Lisa", | |
age: 27, | |
gender: "male", | |
}, | |
]; | |
const names = people.map(({ name }) => name); | |
//will output: [ 'Joseph', 'Anna', 'Patrick', 'Ricardo', 'Lisa' ] | |
console.log(names); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment