If orderCount is already calculated in the const getTotal and getTax,
why do we need to include it in return getTax(orderCount) + getSubTotal(orderCount);
Why not just const getTotal = () => { return getTax() + getSubTotal() };
Lets first clarify something, if we declare a function:
/* function declaration with parameter orderCount */
const getTax = (orderCount) => {
/* function content */
}
we can decide to give it a parameter orderCount. Now when we call the function:
/* function call with argument */
getTax('argument');
we need to supply an argument, otherwise the function parameter will be undefined, which we can see:
/* function declaration with parameter orderCount */
const getTax = (orderCount) => {
/* logging value of parameter to console */
console.log(orderCount); /* should log undefined */
}
/* function call with no argument despite function having a parameter */
getTax();
now, what complicates matters is that you have function calls within the body of a function.
I simplified the examples a bit, and hope you can use this knowledge to see why on this line: