Last active
December 15, 2018 12:45
-
-
Save ronit-mukherjee/b271520c9427bc9b68c9c8a7fa1a6a85 to your computer and use it in GitHub Desktop.
Solution of Program on http://ronitmukherjee.com/practice-javascript-programs-for-interview/#RMJPQ6
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
//https://jsfiddle.net/mukherjeeronit/bs9k6v37/2/ | |
function main(input) { | |
var adultStudentNames = []; | |
for (var i = 0; i < input.length; i++) { | |
var student = input[i]; | |
if (student.age >= 18) { | |
adultStudentNames.push(student.name); | |
} | |
} | |
console.log("Total Count:- ", adultStudentNames.length); | |
console.log("List of Names:- ", adultStudentNames); | |
} | |
var input = [{ | |
name: "Ajay", | |
age: 26 | |
}, | |
{ | |
name: "Amit", | |
age: 16 | |
}, | |
{ | |
name: "Shikha", | |
age: 18 | |
}, | |
{ | |
name: "Manish", | |
age: 62 | |
} | |
]; | |
main(input); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment