Javascript Globals

Javascript being Javascript, there's a variety of global objects.

Window is the original global object since JS originally only ran under browsers. Self is the global object for Web Workers. It's an alias for "window" under browsers. Frames is similar to self and window. The Global object is used under node. At the top level, "this" refers to the global object. Since this code is running under a function, it's scope is limited to this function. globalThis was introduced under ES2020. It should refer to the global object under any environment.