Skip to content

Instantly share code, notes, and snippets.

@CheezItMan
Forked from dHelmgren/translated_me.js
Created May 21, 2019 15:21
Show Gist options
  • Save CheezItMan/9803eb75dcb2142dad5d7a59792b80aa to your computer and use it in GitHub Desktop.
Save CheezItMan/9803eb75dcb2142dad5d7a59792b80aa to your computer and use it in GitHub Desktop.
Finished JS Translation From Ruby
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