Keyword | Scope | Hoisted | Redeclarable | Mutable (value can change) |
---|---|---|---|---|
var |
Function | Yes | Yes | Yes |
let |
Block | Yes | No | Yes |
const |
Block | Yes | No | No (but objects inside can) |
JavaScript is synchronous by default, but it also supports asynchronous behavior through mechanisms like:
JavaScript is both interpreted and compiled
To run JS outside browser, use NodeJS
NodeJS is built on top of V8 Engine
When a JavaScript program runs, the engine creates an Execution Context. The first one it creates is the Global Execution Context (GEC).
There are two phases in the GEC: