Learn Form Validation by Building a Calorie Counter - Step 58

Tell us what’s happening:

I don’t understand the question at all. Here is my solution:

Your code so far

function getCaloriesFromInputs(list) {
  let calories = 0;

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

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.

Replace these two sentences with your copied code.
Please leave the ``` line above and the ``` line below,
because they allow your code to properly format in the post.

Your browser information:

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

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 58

Could you point out to the specific parts of the instructions which are not clear?
I’ll put instruction here:

Remember that you wrote a function earlier to clean the user’s input? You’ll need to use that function here.

Update your currVal declaration to be the result of calling cleanInputString with list[i].value.

2 Likes

Yes but I don’t understand what they mean by call it “with” the list[i].value . And what do they mean by “to be the result of”. From what I know, you call a function like this:

cleanInputString();

you can call function like this, yes

but some functions are meant to be called with the arguments(1 or more)

someFunction(someArgument);

like above

By saying

they mean
Call the function with list[i].value argument

the whole phrase is

Update your currVal declaration to be the result of calling cleanInputString with list[i].value .

currVal declaration is when you are declaring a variable
const currVal = ...

the result of… here - it means all the stuff which should be assigned to the mentioned variable. Or you could say, in more basic terms - all the code which goes after the equal sign

5 Likes

Thak you, it worked!

1 Like

Great explanation! Got me there, and reinforced why. :call_me_hand:

1 Like

Great explanation, you helped me a lot!!

Remember that you wrote a function earlier to clean the user’s input? You’ll need to use that function here.

Update your currVal declaration to be the result of calling cleanInputString with

mod edit: removed solution

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.