Learn Form Validation by Building a Calorie Counter - Step 68

Tell us what’s happening:

I don’t know how reset the global error flag to false. I tried the return false but it does not win

Your code so far

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

function calculateCalories(e) {
e.preventDefault()

}

// 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/123.0.0.0 Safari/537.36

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 68

2 Likes

the global error flag is a variable you declared at the top of your file called isError.
You need to make it false.

1 Like

but that value was already false so why did we have to call that file again ?

Because in the if condition inside getCaloriesFromInputs function it will be true.

However, you need to make it false whenever the calculateCalories function is executed.

In later steps, you will check the isError variable in calculateCalories function after calling getCaloriesFromInputs multiple times.

1 Like