Skip to content

Comment on JavaScript Scope Context Coloringparent

Comments

If you're using strict Javascript (and you should be) there are no implicit global variables.

how would an example of javascript without implicit global variables work? For example, how does it get access to "Array", "require" or "window" ?

(I don't think "use strict" goes to the length of turning javascript into bracha's newspeak but I may likely have no idea what "strict javascript" actually refer to)

You can access global variables as normal, but you can't implicitly declare them by doing `myGlobaVar = 5` - you have to use `window.myGlobalVar`.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.