Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AndriiBozh/efe0b0ff08563d60287aaeca42c16b71 to your computer and use it in GitHub Desktop.
Save AndriiBozh/efe0b0ff08563d60287aaeca42c16b71 to your computer and use it in GitHub Desktop.
CodeWars: count the numbers of JS devs from Europe
ASSIGNMENT
_____________________________
You will be given an array of objects (hashes in ruby) representing data about developers
who have signed up to attend the coding meetup that you are organising for the first time.
Your task is to return the number of JavaScript developers coming from Europe.
If, there are no JavaScript developers from Europe then your function should return 0.
Notes:
The format of the strings will always be Europe and JavaScript.
All data will always be valid and uniform as in the example above.
_____________________________
SOLUTION
_____________________________
function countDevelopers(list) {
return list.filter((obj) => obj.continent === 'Europe' && obj.language === 'JavaScript').length;
};
countDevelopers([
{ 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' }
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment