Skip to main content

2 docs tagged with "variables"

View all tags

Defining variables

Best practices for defining variables in TypeScript. Explains turning magic numbers / magic characters into constants, choosing between const and let, minimizing scope, and not giving a variable multiple meanings, using Bad / Good comparisons.

Variables and constants

A beginner-friendly explanation of the difference between let / const / var and of scope, hoisting, and the TDZ. Covers how const cannot be reassigned but its contents can change, and how var leaks because it is function-scoped, all with practical examples.