Variable in JavaScript
What is a Variable?
A variable is a named container used to store data values that can be used and modified throughout a program.
Declaring Variables
var name = "John";
let age = 25;
const PI = 3.14;
Naming Rules
- Must begin with a letter, underscore
_, or dollar sign$. - Cannot start with a digit or contain spaces.
- Case-sensitive —
ageandAgeare different variables. - Cannot use reserved keywords as variable names.
PreviousTop Features of JavaScript You Need to Know!
Next Variables in JavaScript: Declaration, Types, Scope
Ready to master real-world JavaScript development?
Learn JavaScript hands-on with mentor-led, live sessions.