Created
April 29, 2018 20:00
-
-
Save zbarnes757/f28784a9179cd4c9e2843c72eb2a23eb to your computer and use it in GitHub Desktop.
How Much Meat to Serve
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
function GuysHowMuchMeatShouldIServe(guests) { | |
let totalMeat = 0; | |
guests.forEach(guest => { | |
if (guest.age >= 18 && guest.gender == 'male') { | |
totalMeat += 1; | |
} else if (guest.age >= 18 && guest.gender == 'female') { | |
totalMeat += 0.5; | |
} else if (guest.age < 18 && guest.nationality == 'Texas') { | |
totalMeat += 1; | |
} else { | |
totalMeat += 0.25; | |
} | |
}); | |
return totalMeat; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment