Chapter 3
Working with Variables
In This Chapter
Creating and using variables
Understanding variable scope
Knowing JavaScript’s data types
Naming variables
Using built-in functions to work with variables
“Beauty is variable, ugliness is constant.”
— Douglas Horton (1891 – 1968)
In this chapter, you discover how to create variables, fill them with values, use functions to find out what type of data is in your variables, convert between different data types, and manipulate the data in your variables.
Understanding Variables
Variables are representative names in a program. Just as x may stand for some as-yet-unknown value in algebra, or x may mark the spot where the treasure is buried on a pirate’s map, variables are used in programming to represent something else.
You can think about variables ...
Don’t forget to visit the website to check out the online exercises relevant to this chapter!