In JavaScript, we can define variables by three keywords var, let, and const. Please get the difference as below:
VAR:: A variable declared with var
is accessible throughout the function or globally if declared outside a function.
LET:: A variable declared with let
is only accessible within the block in which it is defined
CONST:: The variable cannot be re-assigned to a new value. However, their contents can be modified for objects and arrays.