Created
June 26, 2013 00:08
-
-
Save jnewman12/5863645 to your computer and use it in GitHub Desktop.
More loops. Still not where I want to be, but getting better.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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