Skip to content

Instantly share code, notes, and snippets.

@irisjae
Last active July 7, 2018 04:25
Show Gist options
  • Save irisjae/2a4d8fd2d48714946a8478755605c1a7 to your computer and use it in GitHub Desktop.
Save irisjae/2a4d8fd2d48714946a8478755605c1a7 to your computer and use it in GitHub Desktop.
what (globals) can you count on in your js (environment)?

say, both on node and browser?

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects

The answer is most of the 'standard' javascript globally defined objects, except (may be incomplete):

  • ES6 Objects if you're on pre-ES6
  • Intl
  • WebAssembly

; plus,

https://nodejs.org/api/globals.html

thanks to the small number of globals on node, basically only

  • console
  • setTimeout
  • setInterval
  • clearTimeout
  • clearInterval

, which correspond to the following Web APIs

https://developer.mozilla.org/en-US/docs/Web/API/Console
https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope

. Depending on your browser, you will find also find a mixed bag of objects from here

https://developer.mozilla.org/en-US/docs/Web/API

as well.

Have fun js-ing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment