I don’t understand 2 things:

  1. what value does itemCount gets?
  2. what’s wrong with my code?

Did you call the getSubTotal function with passing in the orderCount as a parameter?

As an argument, to be factual, but yes, your function call has no argument, orderCount.

1 Like

But where should i type it? inside the getSubTotal(orderCount) ??

Yes, just as you have written it above.

But i get this output: Your subtotal is NaN

That means it doesn’t have any value right?

Please post your code, not a screenshot.

You have a parameter for the function getSubTotal(). But when you call it, you don’t give it a parameter. Look at this:

var nameCaller = function(name) {
     console.log("Hello " + name);

nameCaller() <-- you need an argument, like "Sam" or "Tom"

Try changing that with your code.

In the call expression, it is not a parameter, but an argument. The parameter is the receiving variable.

Examples should not go against normal practice. It is never a good idea to name a function and its variable the same thing.

@mtf Fixed that. But am I right about that? Or is there something else.

just the terminology.

function foo(parameter) {



I see… Oh no! I was wrong. He is asking what value item count gets. Sorry!

We’re still waiting to see the member’s code. If there is no response then this will end up as an unresolved topic and will get removed eventually.

@mtf I know whats wrong with the code now.

  1. He didn’t obey the instructions
  2. You can’t add any strings like “Your subtotal is”, you have to only call the function in the console.log statement.

I fixed it already, but still i didn’t entirely understand the function of return

let orderCount = 0;

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

const getSubTotal = (itemCount) => {
return itemCount * 7.5;

takeOrder(‘thin’, ‘pepperoni’);
takeOrder(‘thick’, ‘sausage’);
takeOrder(‘normal’, ‘ham’);


Also, i don’t have clear yet where does itemCount gets its value

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