Having Trouble with this last part of function returns in JS


#1

let orderCount = 0;

const takeOrder = (topping, crustType) => {
orderCount++;
console.log('Order: ’ + crustType + ’ pizza topped with ’ + topping);
};

takeOrder(‘mushroom’, ‘thin crust’);
takeOrder(‘spinach’, ‘whole wheat’);
takeOrder(‘pepperoni’, ‘brooklyn style’);

const getSubTotal = (itemCount) => {
return itemCount * 7.5;
};

const getTax = (itemCount) => {
return getSubTotal(itemCount) * 0.06;
getSubTotal(itemCount);
};

const getTotal = (itemCount) => {
return
getSubTotal(itemCount)
+
getTax(itemCount);

};

console.log(getSubTotal(orderCount));


#2

The line after return is unreachable and serves purpose.

Breaking up is hard to do, especially on return expressions, without using a continuation operator, and then only if the line is too long for the screen.

return getSubTotal(itemCount) + getTax(itemCount);

#3

thank you so much, I thought a fundamental misunderstanding of instructions or JS was the issues here!!!Greatly appreciated!!


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.