Functions Return 6


#1

I’m stuck at the Functions Return section of the Javascript lessons.

Codecademy returns this error message at the bottom, however the code itself outputs without any syntax error.

‘Did you put the getSubTotal function call inside of a console.log statement?’

The code seems to output the desired results. However the exercise insists that the code is incorrect.


var orderCount = 0;

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

function getSubTotal(itemCount) {
  return itemCount * 7.5;
}

takeOrder('mushroom', 'thin crust');
takeOrder('olive', 'cheese crust');
takeOrder('spinach', 'regular crust');

console.log (getSubTotal(orderCount));



#2

Hi @chriscyotg,

You should try removing the white space between console.log and (getSubTotal(orderCount));

White space doesn’t matter in real code, but for the sake of this exercise, just remove the space between and it will let you pass (most probably).

Hope it helps. Cheers! :slight_smile:


#3

Thank you @codexthon that actually was the issue. Codecademy could have been more clear with the error!


#4

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