Learn Form Validation by Building a Calorie Counter - Step 64

Tell us what’s happening:

I am on step 64 of calorie counter and i cant figure out how to set the isError to true.
i tried
let isError = true
but that doesnt work.

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

function getCaloriesFromInputs(list) {
  let calories = 0;

  for (const item of list) {
    const currVal = cleanInputString(item.value);
    const invalidInputMatch = isInvalidInput(currVal);

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

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 64

Hi there. You already defined isError way earlier in the code. It’s actually defined on line 7, and with the keyword let ; you can’t define the same variable multiple times in the same scope.

Let me know if you have any further issues. Happy coding. :slight_smile:

you are correct. it was the “let” that was wrong. tyty