Learn Form Validation by Building a Calorie Counter - Step 68

Tell us what’s happening:

I tried passing the code task objective but could not pass it yet, for reasons, am still naive about!

Your code so far

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

/* file: styles.css */

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

function calculateCalories(e) {
    e.preventDefault();
    globalErrorFlag = false;
}

// 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/126.0.0.0 Safari/537.36 Edg/126.0.0.0

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 68

Scroll up and look at the variables that you declared at the start of the code.

One of those is the error flag but it’s not called globalErrorFlag

The “global error flag” is mentioned in the step but it does not refer to a globalErrorFlag variable. Rather it is asking you to set to false a variable which you have previously created in the global scope. Check the code at the top where all the global variables were declared. Which one do you think is the variable they want you to reset? There is only one variable in the global scope that seems to be applicable.

1 Like

Absolutely, IsError seems relative but its already set to false!

1 Like

Absolutely, IsError seems relative but its already set to false

It’s initialized to false. Maybe it will change at some point.

The point is that this function needs to reset it to false, regardless.

1 Like

Thank you very much, that helps really quick.

1 Like

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