Chapter 3

Working with Variables

In This Chapter

arrow Creating and using variables

arrow Understanding variable scope

arrow Knowing JavaScript’s data types

arrow Naming variables

arrow 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.

ontheweb Don’t forget to visit the website to check out the online exercises relevant to this chapter!

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 ...

Get Coding with JavaScript For Dummies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.