[Solved!] Intro to Functions Part 5 Error Message


Hello everyone,
Before I begin, you should know that I am new to Codecademy, so this may be a simple problem.
On part 5 of Intro to Functions (Link), I keep getting an error message that says “Declare a variable named orderCount set equal to the number 0.”

My code:

let orderCount = 0;
const takeOrder = (topping, crustType) => {
  console.log(`Order: ${crustType} pizza topped with ${topping}.`);
  orderCount ++;
const getSubTotal = (itemCount) => {
  return itemCount * 7.5

takeOrder('mushrooms', "thin crust");
takeOrder("bacon", 'thick crust');
takeOrder("pineapples", 'no crust');

I’m pretty sure that I declared the variable at the top, but it always shows that error. I’ve tried rewriting everything, refreshing the page, and exiting the lesson.



Your code works fine in the console. It could be something as simple as,

orderCount ++;

instead of,



return itemCount * 7.5

instead of,

return itemCount * 7.5;


Thanks! It worked after that, and I also added a semicolon on the end of line 8.


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