# Learn Form Validation by Building a Calorie Counter - Step 56

**URL:** <https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-56/666647>\
**Category:** Curriculum Help\
**Tags:** javascript\
**Created:** [January 23, 2024, 11:07pm UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-56/666647 "2024-01-23T23:07:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![welchthe103083](https://avatars.discourse-cdn.com/v4/letter/w/76d3ee/32.png) [@welchthe103083](https://forum.freecodecamp.org/u/welchthe103083)\
**Post date:** [January 23, 2024, 11:07pm UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-56/666647/1 "2024-01-23T23:07:06Z")

</div>

### Tell us what’s happening: I’m pretty sure I have the for loop correct but it is still telling me I need to initialize i to 0

### function getCaloriesFromInputs(list) {

let calories = 0;  
for (i = 0; i \< list.length; i++) {

};  
}

WARNING

The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.

You will need to take an additional step here so the code you wrote presents in an easy to read format.

Please copy/paste all the editor code showing in the challenge from where you just linked.

```plaintext
function getCaloriesFromInputs(list) {
  let calories = 0;
  for (i = 0; i < list.length; i++) {

  };
}

```

### Your browser information:

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0`

### Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 56

> **[freeCodeCamp.org](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-form-validation-by-building-a-calorie-counter/step-56)**
>
> Learn to Code — For Free

---

<div class="post-metadata">

**Author:** ![ceejster](https://avatars.discourse-cdn.com/v4/letter/c/6bbea6/32.png) [@ceejster](https://forum.freecodecamp.org/u/ceejster)\
**Post date:** [January 23, 2024, 11:10pm UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-56/666647/2 "2024-01-23T23:10:32Z")

</div>

You need to declare i by using the `let` keyword. I think that should work

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [July 24, 2024, 11:10am UTC](https://forum.freecodecamp.org/t/learn-form-validation-by-building-a-calorie-counter-step-56/666647/3 "2024-07-24T11:10:42Z")

</div>

Closed on July 24, 2024, 11:10am UTC

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