Learn Form Validation by Building a Calorie Counter - Step 59

Tell us what’s happening:

I tried declaring the item variable in the for…of loop but still didn’t work, the instructions say I should use const to declare the variable called item, I tried writing my code as for (const item of list) { } but still didn’t work, someone assist me please.

Your code so far

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

/* file: styles.css */

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

function getCaloriesFromInputs(list) {
  let calories = 0;
  const item;
  for (const list of item){
  
  }

}

// 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/133.0.0.0 Safari/537.36 Edg/133.0.0.0

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 59

Hi,
you don’t need to assign a const const item; outside the for of loop.
In your code, it doesn’t look like you’ve tried what you said you tried. :grinning:
How about you try that again?
Good luck!

1 Like

Works now thank you :pray:

1 Like