Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save cesarkohl/8e4fc9cc4ffaabd19a7744474d463516 to your computer and use it in GitHub Desktop.
var students = [
 {name: 'adam', age: 10},
 {name: 'brian', age: 20},
 {name: 'charles', age: 30}
];
var names = students.reduce (function (arrayNames, student) {
 arrayNames.push (student.name);
 return array Names;
}, []);
console.log (names); // ['adam', 'brian', 'charles']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment