An error with JavaScript: 4. Functions' "return" lesson

Hello there. I was wondering why in Javascript: 4. Functions that the result kept ending up being zero. I thought it was strange since the result was supposed to be twenty-two so I decided to search for help. Once I got that done and it turned up as 22.5 for subtotal and 23.85 for total, I realized that there was an error with the lesson. Here is the second step for the “return” lesson of Functions.

“Inside the takeOrder function, set orderCount equal to orderCount plus 1, so that each time the takeOrder function runs, 1 is added to the orderCount.”

The problem is, the lesson does not strictly enforce this. See this incorrect code below:

var orderCount = 0;

function takeOrder(topping, crustType) {
  console.log('Order: ' + crustType + ' crust topped with ' + topping);
  return = orderCount + 1;

function getSubTotal(itemCount) {
  return orderCount * 7.5;

takeOrder('bacon', 'thin');
takeOrder('pepperoni', 'regular');
takeOrder('pesto', 'thin');

When I submit return = orderCount + 1; instead of the correct orderCount = orderCount + 1 in the second step of the lesson, I get a checkmark and proceed to the third step of the “return” lesson. Yet at the end of the “return” lesson, we end up with zero. At the end of the “return II” lesson – if it does not change to orderCount = orderCount + 1;, both the subtotal and total remains at zero.

I hope that codecademy will resolve this issue soon because I imagine this issue can be confusing for a people who makes this mistake and the last thing we want is to unintentionally introduce bad habits in coding.

Let me know if there is a better place to resolve this, but since this issue did come up, I wanted to point it out in the Functions lesson of this Javascript course, especially since after this summer, it will be the only course up.

The engineers would know that if they had the URL, and so would the rest of us. LINK to lesson is the first matter of business in getting quick and correct help,

Understood. I edited my post to link to the lesson.

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