Skip to content

Instantly share code, notes, and snippets.

@AndriiBozh
Created February 27, 2019 14:18
Show Gist options
  • Save AndriiBozh/b8b6cc142c88f9d0db0d5977418eecde to your computer and use it in GitHub Desktop.
Save AndriiBozh/b8b6cc142c88f9d0db0d5977418eecde to your computer and use it in GitHub Desktop.
CodeWars: Is Ruby Coming?
ASSIGNMENT
_______________________
You will be given an array of objects (associative arrays in PHP) representing data about developers
who have signed up to attend the next coding meetup that you are organising.
Your task is to return:
true if at least one Ruby developer has signed up; or
false if there will be no Ruby developers.
_______________________
SOLUTION
_______________________
function isRubyComing(list) {
return list.some((obj) => (obj.language).includes('Ruby'));
}
isRubyComing([
{ firstName: 'Sofia', lastName: 'I.', country: 'Argentina', continent: 'Americas', age: 35, language: 'Java' },
{ firstName: 'Lukas', lastName: 'X.', country: 'Croatia', continent: 'Europe', age: 35, language: 'Python' },
{ firstName: 'Madison', lastName: 'U.', country: 'United States', continent: 'Americas', age: 32, language: 'Ruby' }
])
_______________________
note
could also be written as:
function isRubyComing(list) {
return list.some((obj) => obj.language ==='Ruby');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment