Skip to content

Instantly share code, notes, and snippets.

@jnewman12
Created June 26, 2013 00:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jnewman12/5863645 to your computer and use it in GitHub Desktop.
Save jnewman12/5863645 to your computer and use it in GitHub Desktop.
More loops. Still not where I want to be, but getting better.
// The exercises we did as part of the code challenege on Wednesday 6/19
people = [
{
firstname : 'Natalia',
lastname : 'Fiero',
height: 63,
interests : [
'golf',
'dressage'
]
},
{
firstname : 'andy',
lastname : 'arnoldsson',
height : 71,
interests : [
'kites',
'basketball'
]
}
];
firstnames = [];
lastnames = [];
interests = [];
averageHeight = 0;
1. go through each element of the list
2. go inside the first element and get the first names to an array
//First Names
firstnames = []
i = 0
while (i < people.length; i++) {
firstnames.push(people[i].firstname);
i++;
}
// Height
totalHeight = 0;
for (i = 0; i < people.length; i++){
firstnames[i] = people[i].firstname;
lastnames[i] = people[i].lastname;
for ( h = 0; h < people[i].interests.length; h++)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment