Skip to content

Instantly share code, notes, and snippets.

@Tocacar
Created April 26, 2019 06:09
Show Gist options
  • Save Tocacar/b0cb3a38575a834c0c4ae835b631f055 to your computer and use it in GitHub Desktop.
Save Tocacar/b0cb3a38575a834c0c4ae835b631f055 to your computer and use it in GitHub Desktop.
var people = [{
name: 'anne',
pets: ['dog', 'cat']
},
{
name: 'jim',
pets: ['dog']
},
{
name: 'sam',
pets: ['rabbit', 'cat']
},
{
name: 'kay',
pets: ['dog', 'hamster']
},
{
name: 'olive',
pets: ['fish', 'cat']
}
];
for (let i = 0; i < people.length; i++) {
console.log(people[i].name);
for (let j = 0; j < people[i].pets.length; j++) {
console.log(people[i].pets[j]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment