Variables Vs Constants - Part 2

Notes:

Syntax:
var nameOfVariable; // declaration of a variable in JavaScript
nameOfVariable = value; // initialization of a variable in JavaScript

const NAME_OF_CONSTANT = value; // declaration and initialization of a constant

Note: By default the value of a variable will be undefined.
By default the value of a constant will be uninitialized, will lead to an error.

========================================================

var nameOfVariable = value; // declaration and initialization of a variable

========================================================

var nameOfVariable1, nameOfVariable2,...; // declaration of multiple variables
nameOfVariable1 = value; // initialization of a variable
nameOfVariable2 = value; // initialization of a variable
========================================================

// declaration and initialization of multiple variables
var nameOfVariable1 = value, nameOfVariable2 = value,…;
// declaration and initialization of multiple constants
const NAME_OF_CONSTANT1=value, NAME_OF_CONSTANT2=value,...;

Interview Questions: