JavaScript Variables
As with algebra, JavaScript variables are used to hold values or expressions.
A variable can have a short name, like x, or a more descriptive name, like carname.
Rules for JavaScript variable names:
- Variable names are case sensitive (y and Y are two different variables)
- Variable names must begin with a letter or the underscore character
The Main thing of javascript variable is u can store any kind of value in that variable even it is string or numeric value.
Note: Because JavaScript is case-sensitive, variable names are case-sensitive.
Example
A variable's value can change during the execution of a script. You can refer to a variable by its name to display or change its value.
var m;
var p;
m = "testing for javascript" ;
p=15;
Comments
Post a Comment