Learn Form Validation by Building a Calorie Counter - Step 62

Hi Community!
Why does the code not accepted in step 62?

Tell us what’s happening:

// running tests After your alert, you should set isError to true.
After you modify isError, you should return the value null. // tests completed

Your code so far:

function getCaloriesFromInputs(list) {
  let calories = 0;

  for (let i = 0; i < list.length; i++) {
    const currVal = cleanInputString(list[i].value);
    const invalidInputMatch = isInvalidInput(currVal);

    if (invalidInputMatch) {
      alert(`Invalid Input: ${invalidInputMatch[0]}`);
      let isError = true;
      return null;

Please post the link to the Step. Also please talk to us about what specifically about the instructions or error message is confusing. Thanks

I also had this issue, looks like an issue with this step, i just reset it and it worked after 10mins of confusion.

isError = true;
return null;

Is correct

1 Like

I think You should not use the “Let” keyword Infront of the isError variable
let isError = true;
return null;



It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

1 Like