What is Nostr?
lamp /
npub1d8y…g8p7
2023-11-02 07:10:29

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.



Author Public Key
npub1d8yfw8f2mrps5u4lcuv6n9qnsvs9ulstyapktkkfp0wveheqa4wsrvg8p7