var myVariableName = myVariableValue ( var (keyword) + myVariableName (this is up to us, whatever we want the variable to be called) + myVariableValue (the value that we assign) ).
// example :
var name = “Lena”;
var age = 2;
var isAdorable = true;
The following rules apply to variable names:
-all variables names must be unique, and can not be duplicate.
-can not contain spaces
-can contain letters, digits, underscores, and dollar signs.
-are case sensitive (Q and q are different variables).
-ending with a period should be avoided, since the period may be interpreted as a command terminator.
- // Valid
var blackDog; // Suggested method named camel case
- // Invalid
In ES2015, two other ways to declare variables were introduced. They are let and const.
- The let keyword allows a new variable to be assigned within the scope of a function or loop while not changing a variable that uses the same name that is outside of the scope of that function or loop. Let is usable in instances where the variable is going to be reassigned.
- The const keyword does not allow a variable name to be reused anywhere within your code. This means that if you assign a variable a name using the const keyword later on you cannot reset that variable to be equal to something else.
Please keep us up to date like this. Thanks for sharing…