Skip to content

Commit

Permalink
completed #18
Browse files Browse the repository at this point in the history
  • Loading branch information
kinwail committed Jun 12, 2018
1 parent b57edc1 commit b5d6bf0
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions exercises.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,8 @@ for(var i =0; i<myFavFoods.length;i++){
var numArray = [2,5,7,9,10];
var total = 0;
function sumItUp(arr){
for(var i=0;i<numArray.length;i++){
total +=numArray[i]
for(var i=0;i<arr.length;i++){
total +=arr[i]
}
return total
}
Expand All @@ -438,6 +438,22 @@ console.log(sumItUp(numArray));
*/

var players = ["Yao Ming", "BrookLin", " Jesus Shuttlesworth", "Manute Bol", "Sidney Deane", "World B Free"];
var east = [];
var west = [];

function allStars(ballers){
for(var i=0; i<ballers.length;i++){
if(i%2 === 0){
east.push(ballers[i]);
}else{
west.push(ballers[i]);
}
}
}
allStars(players);
console.log('east:' + east);
console.log('west:' + west);

/*
* #19
* Function - subways
Expand Down

0 comments on commit b5d6bf0

Please sign in to comment.