1. Scope #

Created Tuesday 14 July 2020

Scopes in JS #

There are 4 scopes in JS, in order of lookup(during use):

  1. Local scope - block scope, function scope.
  2. Enclosing scope - inner function’s scope.
  3. Global scope - variables/functions at the script level, i.e outside of any class/function. This scope is unique.
  4. Built-in - stuff loaded by the intepreter, like console.log() etc. You can hack it.

Note:

Note: Node.js has neither, simply because both window and webpage are irrelevant to an standalone intepreter.