RETURN order count (lesson 5)


#1

I don’t understand why it doesn’t count out that I ordered 3 pizzas? getSubTotal shows 0 not 22.5

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

takeOrder(“cheese”, “thin crust”);
takeOrder(“mushrooms”, “medium crust”);
takeOrder(“onion”, “strong crust”);

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

console.log(getSubTotal(orderCount));


#2

orderCount++ is a shorthand for orderCount = orderCount + 1, so what you wrote here:

orderCount = orderCount++;

if we remove the short hand we get:

ordercount = orderCount = orderCount + 1

that doesn’t look entirely right


#4

It’s easy to see why OP (and myself) were confused. I originally did it correctly, but the HINT for that question tells you to write the wrong thing: 52


#5

Same here, this hint should be changed!


#6

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