Functions 6 return II


#1

I have a problem with this code. It doesn't show the subtotal, tax and the total.
Can you help me please?

var orderCount = 0;

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

function getSubtotal(itemCount){
return itemCount * 7.5;
}
function getTax(){
return getSubTotal* 0.06;
}
function getTotal(){
return getSubTotal+ getTax;
}
}

takeOrder('bacon','thin');
takeOrder('cheese','regular');
takeOrder('pepperoni','thick');
takeOrder('salami', 'regular');
takeOrder('fish', 'thick');
takeOrder('veggies', 'regular');

console.log(function getSubtotal(orderCount){
return itemCount * 7.5;
});
console.log(function getTax(){
});
console.log(function getTotal(){
});


#2

Okay, I will give you a clue. For instance, here,

You have already created this function, and you want to log it to the console, using orderCount as the argument. You shouldn't repeat that function definition.

You could instead do this:

console.log(getSubtotal(orderCount));

I hope I helped! :wink:


#3

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