Skip to content

Instantly share code, notes, and snippets.

@alegut
Created February 21, 2020 07:33
Show Gist options
  • Save alegut/856f599526014cd2d22cfa3ced7ef9b4 to your computer and use it in GitHub Desktop.
Save alegut/856f599526014cd2d22cfa3ced7ef9b4 to your computer and use it in GitHub Desktop.
Filter Nested Arrays
const arr = [
[{ id : 1, name: "a" },{ id : 2, name: "b" }],
[{ id : 3, name: "c" },{ id : 4, name: "d" }]
]
const filteredArr = arr.reduce((a,b) => a.concat(b))
.filter((obj) => obj.id === 3);
console.log(filteredArr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment