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 forletvariable 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 forconstvariable names.
-
var- can be declared and defined multiple times.
var age = 123;
NOTE:camel case is used forvarvariable names.