tipCalculator

Hello,

I’m trying to solve the calculator and I’m getting ’undefined’ what am I missing below?

const tipCalculator = (quality, total) => {

  switch(tipCalculator) {
    
    case 'bad':
      return total * .05;

    case 'ok':
      return total * .15;

    case 'good':
      return total * .20;

    case 'excellent':
      return total * .30;
      
    default: total * .18;
  
}

console.log(tipCalculator('bad', 100)) //should return 20

From your case statements, it looks like you are trying to match the value to one of your parameters, quality. tipCalculator is the name of the function. It isn’t going to match any of your cases.