Return II

I’m not getting a the green signal on the 4th instruction, can anyone tell me why could this be? The code is running well tho…

https://www.codecademy.com/courses/learn-javascript-functions/lessons/functions/exercises/return-ii?action=resume_content_item&course_redirect=introduction-to-javascript

let orderCount = 0;

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

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

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

takeOrder('thin', 'pepperoni');
takeOrder('thick', 'sausage');
takeOrder('normal', 'ham');

console.log(getSubTotal(orderCount));

console.log(getTotal(orderCount));

/* will output:
Order: thin pizza topped with pepperoni
Order: thick pizza topped with sausage
Order: normal pizza topped with ham
22.5
23.85
*/

getTotal doesn’t have any parameters, look:

const getTotal = () => 

no parameters, otherwise there would be parameters between the parentheses

yet when you call the function, you supply an argument. Why? Arguments are only needed when the function has parameters

But you said in the instructions there should be no parameters. It doesn’t make sense.

true, i am showing that there are not parameters at function declaration, so i am questioning why objectslayer does supply arguments at function call

Oh, okay. I realized that it’s uneccisary to provide the info. Thanks.

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