Chapter 4. VariablesA variable is a name associated with a value; we say that the variable stores or contains the value. Variables allow you to store and manipulate data in your programs. For example, the following line of JavaScript assigns the value 2 to a variable named i:
And the following line adds 3 to i and assigns the result to a new variable, sum:
These two lines of code demonstrate just about everything you need to know about variables.
|
Wednesday, October 14, 2009
Chapter 4. Variables
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment