5 ms·
"everything you do is global, unless you know better" That is not the JavaScript model at all.
by swannodette 15y ago
"everything you do is global, unless you know better"
That is not the JavaScript model at all.
- lnanek 15y agoHe is talking about if you don't do anything extra (in this case, use the var keyword). Much like the nonlocal keyword in Python requires knowing about it and wanting to use it in order to actually use it and get the non-default behavior.
- swannodette 15y agovar is not extra in JavaScript the way nonlocal is in Python. var is a language construct that any good JavaScript program must use.