The function parameter
mode hides the higher-scoped function
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.