JS Variables or Java script Variables

A variable is a symbolic name associated with a value. Variable uses “var” to define.


<script >

var abcde; // abcde is a variable

var abc888; //abc888 is a variable

var my_variable; //my_variable is a variable



abcde, abc888 and my_variable are all variables.

They can store some value. e.g.

var abcde=100;

var abc888=”Hello World”;

var my_variable=true;

Notice that variable naming cannot start with numbers, cannot have spaces. e.g. “23var”, “abc de” are invalid variable names.

But “var23”, “abcde” are valid variable names.

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Privacy & Cookies Policy