I'm trying to solve a problem for a course I'm currently doing, but I've been stuck on why my code returns undefined for about an hour now.
I've switched a few things around, added brackets to make sure things are in order, idk what else to try.
var bills = [124, 48, 268];
function tipsCalculator(bill) {
switch (bill) {
case bill < 50:
return (bill * (20 / 100));
case bill >= 50 && bill <= 200:
return (bill * (15 / 100));
case bill > 200:
return (bill * (10 / 100));
}
}
var testing = tipsCalculator(bills[0]);
console.log(testing);
I expect it to return the calculation of the 124 * whichever
case that value fits.