why does my javascript function not call another function?

The function parameter mode hides the higher-scoped function mode(parameter). JavaScript doesn’t keep a dictionary of names and infer which one you meant to use by how it’s being used, so there’s no way for it to know that the first mode you write was supposed to be a different one than the second mode. You have to make this distinction yourself.

The simplest solution is to change the name of the parameter or the name of the function so one isn’t hiding the other. I think mode is a terrible name for a function, as it describes nothing about what the function does. Try renaming it to submitMode or something else.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top