getTax Parameter


#1

So this is a basic question but - here is part of the pizza.js lesson instructions:

“Let’s start with calculating the tax. Under the getSubTotal() function, create a function expression using the variable const named getTax. It should take one parameter, orderCount”

According to Codecademy, the correct answer is:

const getTax = () => { return getSubTotal(orderCount) * 0.06; };

With the empty parentheses. But I thought that when they say that getTax should take one parameter, you would need to declare the parameter in the parentheses when introducing the function, like below:

const getTax = (orderCount) => { return getSubTotal(orderCount) * 0.06; };

Do you not always need to declare the parameter in the parentheses if you want the function to take the parameter?

Thanks!


#2

Hi @cliffgallagher,

Report was filed. However, CodeCademy is in the midst of rolling out new courses currently, I guess this change will take a while to happen (I do not speak for them). Essentially, you have quite a similar question to another user posted a while ago that I replied to. I will link down below for your reference:

It’s a rather lengthy reply, so I just link it rather than posting the same thing again.

Hope this helps. :slight_smile:


#3

Hi @codexthon, got it, thanks!


#4

I noticed that the hint for this passes orderCount to getTax, but when I finally clicked “get code”, it doesn’t pass that in.

HINT:
const getTotal = () => {
return getSubTotal(orderCount) + getTax(orderCount);
};

ANSWER:
const getTotal = () => {
return getSubTotal(orderCount) + getTax();
};


#5

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