re: Daily Challenge #56 - Coffee Shop VIEW POST

FULL DISCUSSION
 

Here's mine:

function getCoffee(change) {
  const changeSum = change.reduce((a,b) => a + b);

  switch(changeSum) {
    case(2.20):
      return ("Here is your Americano, have a nice day!");
      break;
    case(2.30):
      return ("Here is your Latte, have a nice day!");
      break;
    case(2.40):
      return ("Here is your Flat white, have a nice day!");
      break;
    case(3.50):
      return ("Here is your Filter, have a nice day!");
       break;
    default:
      return ("Sorry, exact change only, try again tomorrow!");
  }
}
code of conduct - report abuse