Skip to content

Instantly share code, notes, and snippets.

@zempo
Created December 12, 2018 06:41
Show Gist options
  • Save zempo/8d6d31ee7cbbe1e3efb61c21542891d6 to your computer and use it in GitHub Desktop.
Save zempo/8d6d31ee7cbbe1e3efb61c21542891d6 to your computer and use it in GitHub Desktop.
Looping over collections of objects example created by zempo1 - https://repl.it/@zempo1/Looping-over-collections-of-objects-example
const users = [
{
name: 'Bernard',
age: 29,
birthMonth: 'April',
},
{
name: 'Bernice',
age: 14,
birthMonth: 'December',
},
{
name: 'Gerard',
age: 88,
birthMonth: 'June',
},
{
name: 'Stella',
age: 3,
birthMonth: 'September',
},
];
users.forEach(user =>
console.log(`${user.name} will be ${user.age + 1} in ${user.birthMonth}`)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment