3 ms·
Consider 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 entiret
by xamuel 9y ago
Consider 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.