Functions 6/7

Hey guys, i have a problem with this code. Still don’t validate, but i can’t see where’s the problem.

var orderCount = 0;

function takeOrder(topping, crustType) {
console.log('Order: ’ + crustType + ’ 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();

takeOrder(‘Ketchup’, ‘Margarita’);
takeOrder(‘Bolognaise’, ‘Piment’);
takeOrder(‘Vinaigre’, ‘Tomate’);

console.log(‘The total price is ’ + getTotal(ordercount) + ’ $.’);

Last line of your code is console.log('The total price is ' + getTotal(ordercount) + ' $.');
But ordercount is not defined, only orderCount.
You got typo :slight_smile:

Thanks, i see dat and rectify my error, but it still doesn’t work :frowning:

Is there any specific error in the assignment that warns you about possible problem ?

Yeah ; it’s :slight_smile:
“Did you put the getTotal() function call inside of a console.log statement?”

But i think i did

edit : when i run the script, it works very well

Ok then. It might be problem with assignment parser that expects exactly what it said right now.
Try writing only console.log(getTotal(orderCount)); without the strings added

I try, the console show the total price but instructions don’t validate.

Can you please post here a screenshot of your assignment. I can’t enter it because I didn’t that course so it’s locked for me.

console.log(getTotal()); at the last line

Thanks dude, you was helpful

1 Like

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