Functions 6/7


#1

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(getSubTotal(orderCount));
console.log('The total price is ' + getTotal(ordercount) + ' $.');


#2

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:


#3

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


#4

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


#5

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


#6

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


#7

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


#8

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.


#9


#10

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


#11

Thanks dude, you was helpful


#12

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