lamp on Nostr: I encountered this unexpected behavior of #javascript. Apparently a `var` statement ...
I encountered this unexpected behavior of #javascript.
Apparently a `var` statement ANYWHERE in the function, even if in a block that is afterwards and does not run, changes the scope of the variable name.
What I was expecting, was that the global variable would have its value changed, and then the following var statement (if it did run) would from THEREON overshadow the global variable.
Apparently a `var` statement ANYWHERE in the function, even if in a block that is afterwards and does not run, changes the scope of the variable name.
What I was expecting, was that the global variable would have its value changed, and then the following var statement (if it did run) would from THEREON overshadow the global variable.