Learn Form Validation by Building a Calorie Counter - Step 65

Tell us what’s happening:

There must be some small detail im missing here, But I just can’t see it. it’s telling me to use the addition assignment operator on calories…but i’m pretty sure I am. What’s wrong with my syntax?

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]}`);
      isError = true;
      return null;
    }

    currVal = Number(currVal);
    calories += currVal;
  } 

}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 65

probably you need to do this all in one line

1 Like

Thats absolutely what it was, i literally just let it be yesterday walked away ( i had literally been coding for like 5 hours yesterday) came back with a fresh set of eyes, and it was literally that, just putting it all on one line. Thank you so much for your feedback. You guys are literally doing the lord’s work here lol.