Code Lab

Count in a response

EasyJSON and data4 min

An API returned an array of meetup guests. Each one has the fields name, continent and language. Write a function countEuropeanJsDevs(developers) that returns how many guests live in 'Europe' and write 'JavaScript'.

Examples

countEuropeanJsDevs([{ name: 'Noah', continent: 'Europe', language: 'JavaScript' }, { name: 'Maia', continent: 'Oceania', language: 'JavaScript' }, { name: 'Lukas', continent: 'Europe', language: 'Python' }])

Returns 1

Only Noah matches.
countEuropeanJsDevs([])

Returns 0

Source

Loading the editor...
  1. InputcountEuropeanJsDevs([ { name: 'Noah', continent: 'Europe', language: 'JavaScript' }, { name: 'Maia', continent: 'Oceania', language: 'JavaScript' }, { name: 'Lukas', continent: 'Europe', language: 'Python' } ])
    Expected1
  2. InputcountEuropeanJsDevs([ { name: 'Anna', continent: 'Europe', language: 'JavaScript' }, { name: 'Omar', continent: 'Africa', language: 'Python' }, { name: 'Elena', continent: 'Europe', language: 'JavaScript' }, { name: 'Ken', continent: 'Asia', language: 'JavaScript' } ])
    Expected2
  3. InputcountEuropeanJsDevs([])
    Expected0

Hidden tests run on Submit.