0

I have to return the value they have in color = rojo and their name = contain 'n' and 'a' can you give me a hint? in JavaScript

ovejas = [ { 'name': 'Noa', 'color': 'azul' }, { 'name': 'Euge', 'color': 'rojo' }, { 'name': 'Navidad', 'color': 'rojo' }, { 'name': 'Ki Na Ma', 'color': 'rojo'}, { 'name': 'AAAAAaaaaa', 'color': 'rojo' }, { 'name': 'Nnnnnnnn', 'color': 'rojo'} ]

5th Sep 2022, 7:12 PM
Josué Varela
Josué Varela - avatar
2 odpowiedzi
5th Sep 2022, 8:24 PM
Mustafa A
Mustafa A - avatar
+ 2
ovejas.forEach(o => { if(o.color == 'rojo') { let nm = o.name.toLowerCase(); if ( nm.indexOf("n")>=0 && nm.indexOf("a")>=0) console.log(o.name); } });
5th Sep 2022, 8:47 PM
SoloProg
SoloProg - avatar