Skip to content

Instantly share code, notes, and snippets.

@jeromelachaud
Created September 14, 2017 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeromelachaud/37a5ac165b84f3bc8811a9045d968f32 to your computer and use it in GitHub Desktop.
Save jeromelachaud/37a5ac165b84f3bc8811a9045d968f32 to your computer and use it in GitHub Desktop.
ZXYmXm
const animalsArray = [
{
"name": "Lilou",
"species": "cat",
"size": "small",
"weight": 5
},
{
"name": "Maïna",
"species": "cat",
"size": "small",
"weight": 10
},
{
"name": "Brico",
"species": "cat",
"size": "medium",
"weight": 30
},
{
"name": "Dumbo",
"species": "elephant",
"size": "big",
"weight": 5000
}
]
const cats = animalsArray
.filter((animal) => animal.species === "cat")
.map((animals) => animals.name)
console.log(cats)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment