Closure and this - How are variables resolved within a function?
Let's start with a example of closure -
function outer() {
// scope A
var myText = 'Hello'
return function inner() {
// scope B
console.log(myText)
}
}
{
// scope C
let myText = 'World'
let fn = outer()
fn();
}
Here we have ...
bendtherules.hashnode.dev7 min read
Aquib Vadsaria
Software Developer in pursue of becoming Software Engineer
Great article to know inner working of scope resolution in JS. Small suggestion - would had been easy to understand (soak in this information) if there was some kind of visualisation (block diagram or flow chart, etc)