Learn Form Validation by Building a Calorie Counter - Step 57

Tell us what’s happening:

I am stuck in this step for hours. Help me please;

Your code so far


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.

function getCaloriesFromInputs(list) {
  let calories = 0;
  currVal = "";

  for (let i = 0; i < list.length; i++) {
  value = list[i];

Your browser information:

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

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 57

What are the instructions asking you to do?
What error are you getting?

1 Like

Welcome to the forum @pdro996

There are a few things to fix in your code, so start with one at a time.

The variable mentioned in the instructions needs to be in the loop function.

Happy coding

1 Like

Also, these steps are meant to be solved in minutes, not hours. If you try a few things and it still isn’t working, don’t keep hitting your head against that wall. First, look at the console. Are there some errors listed you can take care of? Second, copy your code over to something like play code.io where any syntax errors will be better highlighted. Third, check sources like MDN and W3 schools to see how the command is meant to be used, if it takes any arguments/parameters, and what it returns (example, Google JavaScript .split and find the relevant resource to see how to use .split to separate a string). Fourth, add a console.log to check variable states to make sure inputs and outputs are as planned.

1 Like