Skip to content

Instantly share code, notes, and snippets.

View kofoworola's full-sized avatar

Kofo Okesola kofoworola

View GitHub Profile
@kofoworola
kofoworola / filter.js
Last active May 25, 2019 13:15
Hotjar code sample
function filterAndGroup(people){
//Add empty object to offset it
people.unshift({})
//Use reduce method to loop through and sort
return people.reduce((grouped,obj) => {
//Gender of current item
const gender = obj.gender;
//Check age requirement
if(obj.age >= 30 && obj.age <= 40)
{