4
Why am I not able to return only the objects containing the discipline Matemática
?
I’m using the methods map()
, filter()
and, within the filter()
, the includes()
, but is returning all objects.
Can not use chained as I did, having to be triggered methods:
let dados = [
{nome: 'Noah', disciplinas: ['Matemática', 'Geografia', 'Inglês']},
{nome: 'Gael', disciplinas: ['Química', 'Geografia', 'Português']},
{nome: 'Caleb', disciplinas: ['Matemática', 'Física', 'Artes']}
]
let discip = dados.filter(a => a.disciplinas.filter(b => b.includes('Matemática')))
console.log(discip)
Right then, I understood Maniero, I really abused the method. Thank you!
– user194399