Three ways to define variables in JavaScript.
-
let
- can be declared only once.
- can be defined multiple times.
let firstName = "Ironman";
NOTE:
camel case is used forlet
variable names.
-
const
- can be declared and defined only once.
- values of these variables are immutable where we cannot change them again.
const PI = 3.14;
NOTE:
uppercase is used forconst
variable names.
-
var
- can be declared and defined multiple times.
var age = 123;
NOTE:
camel case is used forvar
variable names.