Created
February 21, 2020 07:33
-
-
Save alegut/856f599526014cd2d22cfa3ced7ef9b4 to your computer and use it in GitHub Desktop.
Filter Nested Arrays
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 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