Skip to content

Instantly share code, notes, and snippets.

@furenku
Created June 19, 2018 01:13
Show Gist options
  • Save furenku/5d9e5f2d258196bb3d81e40703099908 to your computer and use it in GitHub Desktop.
Save furenku/5d9e5f2d258196bb3d81e40703099908 to your computer and use it in GitHub Desktop.
array filtering inside array
personas = [
{
nombre: "juan",
materias: [
{
id: "GEO001",
name: "geografia 1"
},
{
id: "BIO001",
name: "biologia 1"
},
]
},
{
nombre: "marta",
materias: [
{
id: "GEO002",
name: "geografia 2"
},
{
id: "BIO002",
name: "biologia 2"
},
]
},
]
resultado = personas.filter(i=>{
return i.materias.map(j=>j.id=="BIO001").includes(true)
})
console.log( resultado )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment