Here’s my code than produces an “unexpected token else”, I tried the switch syntax and it worked fine. However i can’t make it work with multiple if’s.
const tipCalculator = (quality, totalCost)=>
{
if (quality===“bad”){return 0.05totalCost};
else if (quality===“ok”){return 0.15totalCost};
else if (quality===“good”){return 0.2totalCost};
else if (quality===“excellent”){return 0.3totalCost};
else {return 0.18*totalCost};}
console.log (tipCalculator(“bad”, 60))
console.log(tipCalculator(‘good’, 100))
You can find the exercise here https://www.codecademy.com/paths/front-end-engineer-career-path/tracks/fecp-22-javascript-syntax-part-i/modules/wdcp-22-practice-javascript-syntax-variables-data-types-conditionals-functions/lessons/javascript-fundamentals-code-challenge/exercises/tip-calculator