🈯const
JS ⟩ declaration ⟩ variable ⟩ const
(declaration) declares a local constant in block scope.
const
must have an initial value❗ (👉 more)
can't be reassigned❗ (👉 more)
can't be redeclared❗
⛔ ReferenceError: cannot access '...' before initialization.
caused by referencing a let/ const/ class in its temporal dead zone❗
✅ it's common to declare const using capital letters.
using typeof on lexical declaration (let/ const/ class) in its temporal dead zone will throw a ReferenceError.
replit:TDZ: let/const/class
Last updated