What lexical scope is in JavaScript
How does the engine know that one function can see another's variables, but not the other way around? In JavaScript it comes down to where the code sits, decided before anything runs. That's lexical scope.
Short notes from what I'm learning and building - one thought, one topic, a few minutes to read.
How does the engine know that one function can see another's variables, but not the other way around? In JavaScript it comes down to where the code sits, decided before anything runs. That's lexical scope.
JavaScript silently converts one type into another all the time. A note on why 1 + "2" is "12" and 1 - "2" is -1, and what the engine actually does between the lines.