Skip to content

Instantly share code, notes, and snippets.

@cesarkohl
Created January 13, 2020 14:22
Show Gist options
  • Select an option

  • Save cesarkohl/d258328e12e6b6c96f4527c11ef0cb0b to your computer and use it in GitHub Desktop.

Select an option

Save cesarkohl/d258328e12e6b6c96f4527c11ef0cb0b to your computer and use it in GitHub Desktop.
var students = [
 {name: 'adam', age: 15},
 {name: 'brian', age: 18},
 {name: 'charles', age: 20}
];
varLarest students = [];
for (var i = 0; i <students.length; i ++) {
 if (students [i] age> = 18) {
 MajorStudents.push (students [i]);
 }
}
console.log (MajorStudents);
// [{name: 'adam', age: 18}, {name: 'brian', age: 20}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment