Created
January 21, 2022 02:14
-
-
Save johnakhilomen/7d26f55c0128c2f9ca69d75ec0ef8b7c to your computer and use it in GitHub Desktop.
This file contains 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 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