Learn Form Validation by Building a Calorie Counter - Step 61

Tell us what’s happening:

You should assign the result of your cleanInputString call to your currVal variable.

I keep getting this error message, please I need help to be able to resolve this

Your code so far

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

/* file: styles.css */

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

    const currVal = item.value;
    cleanInputString(item.value);
    cleanInputString = currVal;

// 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

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 61

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

So, you are asked to do this, right? I think you overlooked a key word in this sentence: Update.

With that in mind, what do you think you need to do to fix your code?

1 Like

calling a function, I am confuse

update… how do I update it

You just need to change the current currVal variable declaration to update it. You have the code you need to complete this task, but it’s in the wrong place.

You want currVal to be the result of calling the cleanInputString() function. It might be easier to Reset this step and start over since you have more code there than you need.

I have tried different method yet its still not updating

const currVal = item.value;
// first method
   currVal = cleanInputString(item.value)  ;
//second one
    cleanInputString = currVal(item.value);

You call a function like this:

functionName(parameter)

yes, I reset the step and start over again

first I called the functionName with the (parameter)

but number 3 which is to change currVal… that’s where I am not getting it

// running tests 3. You should assign the result of your

cleanInputString

call to your

currVal

variable. // tests completed

this is where i find difficult to understand

What is currval assigned to now? You want item.value to be a clean string. That’s why you made the cleanString() function, right?

If you need more help, I’ll be back in about half an hour…

currVal is assigned to

item.value 

patiently waiting please, I need to understand the logic

Is that the same thing as

1 Like

Nope

cleanInputString is a function that takes item.value as a parameter, while currVal is a variable

I am aware. I’m saying that you are not doing what the instructions ask for.

1 Like

:slightly_smiling_face:
I have been looking at my code for like an hour now, but just reading the question and comparing it to what you just asked me now, I was able to pass the step.

sometimes, one need to read the question over and over again… you solution might be looking at you
thank you so much, I appreciate.

1 Like

Understanding the issue at hand is honestly one of the most important and sometimes most difficult parts of programming.

2 Likes