Created
July 14, 2017 10:09
-
-
Save kdekooter/d2427b103a9209fe396e4e47af47271a to your computer and use it in GitHub Desktop.
hotjar question
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Gender = Object.freeze({MALE: 'male', FEMALE: 'female'}) | |
let people = [ | |
{name: 'Bob', gender: Gender.MALE, age: 34}, | |
{name: 'Maria', gender: Gender.FEMALE, age: 34} | |
] | |
function getMales30to40(source) { | |
return source.filter(person => person.gender === Gender.MALE && person.age >= 30 && person.age <= 40) | |
} | |
function test() { | |
let result = getMales30to40(people) | |
console.log(`Found ${result.length} males between 30 and 40`) | |
} | |
test() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment