JavaScript Variables
Variables are used to store data in a JavaScript program.
JavaScript provides three keywords for declaring variables:
- let
- const
- var
Example
let age = 21;
const name = "Alex";
var city = "Indore";
let
A variable declared with let can be reassigned.
const
A variable declared with const cannot be reassigned.
var
var is the older way of declaring variables and is generally avoided in modern JavaScript.