3 ms·
How are they related sorry? I know in ES6 closures inherit the scope they are declared in, but I don't think that's a required part of the concept is it?
by SCdF 9y ago
How are they related sorry?
I know in ES6 closures inherit the scope they are declared in, but I don't think that's a required part of the concept is it?
- xamuel 9y agoConsider this ES6 program: (function(){let x=0; let f=()=>{x=1}; f(); console.log(x);})() Is x a "global mutable state" variable? If the above is the entirety of the program, then essentially yes. If you say "no, x is not global mutable state", then "global mutable state" is pretty meaningless in JS, since any script can be wrapped like above.