Skip to content

Instantly share code, notes, and snippets.

@kdekooter
Created July 14, 2017 10:09
Show Gist options
  • Save kdekooter/d2427b103a9209fe396e4e47af47271a to your computer and use it in GitHub Desktop.
Save kdekooter/d2427b103a9209fe396e4e47af47271a to your computer and use it in GitHub Desktop.
hotjar question
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