How to define variable in Javascript

We define variables to store some value in our programming script. We can define a variable as below:

Var name = “Vivek Rastogi”;

Let age = 44;

Const emp_code = 1001;

The best way to use the variable names are 

Camel Case:: myName

Pascal Case:: MyName

Snake Case:: my_name

We can not use javascript keywords as variables like let, sum, if, and while, etc.

We can not start variable name numbers like var 12name, or var 5age.

We can not use space or special characters except underscore like

var your-name = “Vivek” //wrong

var your*age = 44; //wrong

Leave a Comment

Your email address will not be published. Required fields are marked *