var confirm = confirm('Are you sure?');
I just tested this statement, and I was given an error indicating that confirmit is not a function.
I immediately discovered that the variable name overwrites it. However, my question is: why?
I know that functions are first-class, and that declaring a variable with the same name as the function will rewrite it in the relative field. But my confusion comes from what I thought was a right-to-left execution, I.E. a function call is made before the destination is determined.
Is the variable defined in this case before the function call?
source
share