- var → Function-scoped, can be redeclared. (Older way, avoid in modern JS)
- let → Block-scoped, can be updated but not redeclared in the same scope.
- const → Block-scoped, cannot be updated (immutable reference).
Example:
var x = 10; // function scoped
let y = 20; // block scoped
const z = 30; // constant
Leave a Reply