I have to return the number of JavaScript developers coming from Europe. I have an array containing 4 objects. (names, country and language etc)
//for reference and to clarify question
var list1 = [
{ firstName: 'Noah', lastName: 'M.', country: 'Switzerland',
continent: 'Europe', age: 19, language: 'JavaScript' },
{ firstName: 'Maia', lastName: 'S.', country: 'Tahiti', continent:
'Oceania', age: 28, language: 'JavaScript' },
{ firstName: 'Shufen', lastName: 'L.', country: 'Taiwan',
continent: 'Asia', age: 35, language: 'HTML' },
{ firstName: 'Sumayah', lastName: 'M.', country: 'Tajikistan',
continent: 'Asia', age: 30, language: 'CSS' }
];
//my code below
function countDevelopers(list) {
let euro = 0;
for( let coder = 0; coder < list.length; coder++ ){
list[coder]["continent"];
if( list[coder]["continent"] == 'Europe' ){
for (let lang = 0; lang < list[coder].length; lang++ ){
list[lang]["language"];
if( list[coder][lang]["language"] == 'Javascript'){
euro++;
}
}
}
}
return euro;
}