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'} ]
2 Answers
+ 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);
}
});