The meaning of variables is the same in all the programming languages. Basically, variables in programming languages are used to store some values for later use.
Headings of Contents
- 5 Declare many variables in One statement
- 10 Conclusion
var x, y, z; x = 34; y = "programmingfunda"; z = 12.0;
In above example we have declared three variable x,y and z using var keyword.
x store the value 34. y store the value 'programmingfunda'. z store the value 12.0.
- Name can contain a letter, digits, underscore, and Doller sign.
- The name must begin with a letter.
- Name can also begin with $ and _.
- Name must be unique (firstName and firstname are different variables).
After the declaration of the variable with no value, technically it has the value undefined.
To assign the value to the variable, use equal ( = ) sign.
firstName = 'programmingfunda';
In above example we have create a variable firstName and assign value programmingfunda.
Declare many variables in One statement
var firstName = 'programming', lastName = 'funda';
Reference:- Click Here