Skip to content

Instantly share code, notes, and snippets.

@johnakhilomen
Created January 21, 2022 02:14
Show Gist options
  • Save johnakhilomen/7d26f55c0128c2f9ca69d75ec0ef8b7c to your computer and use it in GitHub Desktop.
Save johnakhilomen/7d26f55c0128c2f9ca69d75ec0ef8b7c to your computer and use it in GitHub Desktop.
const getMaleStudents = function(students){
studentList = []
for (let i = 0; i < students.length; i++) {
if (students[i].gender == "Male") {
studentList.push(students[i])
}
}
return studentList;
}
function abstractMaleStudents()
{
const maleStudents = getMaleStudents([
{
fullname: "Jane Doe",
gender: "Female"
},
{
fullname: "Jon Doe",
gender: "Male"
}
]);
return maleStudents;
}
console.log(abstractMaleStudents() )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment