Variable

Variable

The variable is used to store values in it. In order to give names to any variable it's recommended to give a meaningful name.

Declaring Variable

let message; // declaring a variable

Once any variable is been declared we need in initialize that variable.

For Example,

message = "Good Morning"

We can also initialise and declare a variable at the same time.

let message = "hello"

There are set of rules define defined in javascript which must be followed when variable name convention is given:

  1. variable names must not be reserved keywords like function , let, var const and many more.

  2. variable must not start with numeric values like 123message , 3.14PI .

  3. variables are case-sensitive. That means message , Message both are different.

  4. the variable must contain letters, numbers, an alphanumeric set of characters, _ and $ and it can't be separated by spaces.