JavaScript - Functions - Exercise 6: Issue with Total at end


#1


https://www.codecademy.com/courses/learn-javascript/lessons/functions/exercises/functions?action=lesson_resume


The total is suppose to be the tax + subtotal but I keep getting 0. What Am I doing wrong?


var orderCount = 0;

function takeOrder(topping, crustType) {
	return 'Order: ' + crustType + ' crust pizza topped with '  + topping;
  orderCount = orderCount + 1;
}

function getSubTotal(itemCount) {
  return itemCount * 7.5;
}

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

function getTotal() {
  return getSubTotal(orderCount) + getTax();
}

console.log(takeOrder('bacon', 'thin'));
console.log(takeOrder('pesto', 'regular'));
console.log(takeOrder('pepporoni', 'thin'));

console.log(getSubTotal(3));
console.log(getTotal());


#2

When you log getSubTotal() to the console at the end, change 3 to orderCount. That's the only thing I can see that could be considered incorrect...


#3

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