Pizza returns 0


The code is giving a subtotal of 0 despite the fact that I've ordered three pizzas and the takeOrder() function is set to increment orderCount.

var orderCount = 0;
var takeOrder = function(topping, crustType) {
  return('Order: ' + crustType + ' crust pizza with ' + topping);
var getSubTotal = function(itemCount) {
  return (itemCount * 7.5);

takeOrder('mushroom', 'thin');
takeOrder('bacon', 'thick');
takeOrder('pepperoni', 'thin');



The return statement ends the function immediately, ignoring any code below it. In its current state, your takeOrder() function does not increment orderCount.


OK thanks! By any chance do you know a more technical explanation of why return does that? Is it somehow necessary to avoid some other type of problem?


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