JavaScript getTax() function not passing Functions return II


#1

var orderCount = 0;
function takeOrder(topping, crustType) {
  console.log('Order: ' + crustType + ' crust topped with ' + topping);
  orderCount = orderCount + 1;
}
function getSubTotal(itemCount) {
  return itemCount * 7.5;
}
function getTax() {
  return getSubTotal(itemCount) * 0.06;
}

takeOrder('bacon', 'thin');
takeOrder('pepperoni', 'regular');
takeOrder('pesto', 'thin');
console.log(getSubTotal(orderCount));

What's the problem with my code, it won't pass to next exercise.


#2

Please provide us with the link to the lesson...


#3

Hi @pypro89823, I think I know where the problem is.

function getTax() {
return getSubTotal(itemCount) * 0.06;
}

change itemCount (parameter) into orderCount (argument), you would want to pass in argument into getSubTotal() rather than a parameter inside the getTax() function.

function getTax() {
return getSubTotal(orderCount) * 0.06;
}

Should be fine after that, hope it helps. :slight_smile:


#4

thank you that helped me


#5

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