Created
May 20, 2019 17:44
-
-
Save dHelmgren/f4b17d88458ef2f9c4d1d5e82de249fe to your computer and use it in GitHub Desktop.
Finished JS Translation From Ruby
This file contains hidden or 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
const coffeePrice = function coffeePrice(isIced, size, flavorArray){ | |
let price = 2.50; | |
if(size == 0){ | |
; | |
} else if (size == 1) { | |
price += 1; | |
} else { | |
price *= 2; | |
} | |
if (isIced){ | |
price += 0.75; | |
} | |
for(let i = 0; i < flavorArray.length; i++){ | |
console.log(`pumping ${flavorArray[i]}`); | |
price += 0.50; | |
} | |
return price | |
} | |
console.log(coffeePrice(true,3,['vanilla','lemon'])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment