January 2003
Beginner to intermediate
1200 pages
23h 42m
English
Using data is basic to nearly any JavaScript program, and JavaScript supports quite a number of different data types: numbers, Boolean values, text strings, and so on. You store data values in variables in JavaScript.
As with other programming languages, variables are simply named locations in memory that you use to store data. You create variables in JavaScript with the var statement, and when a variable has been created, it's ready for you to store and retrieve data in.
Here's an example. In this case, I'm creating a new variable named temperature and storing a value of 72 in it using the = assignment operator. When I use this variable in code, JavaScript replaces it with the value 72, so I can display the temperature ...