Chapter 4

Embracing JavaScript Variables

In This Chapter

arrow Creating and using variables

arrow Using Boolean values

arrow Using numeric values

arrow Using strings

arrow Defining data collections with arrays

The purpose of most applications is to work with data in some way. Data are defined as any kind of information you want to interact with in some fashion — anything from simply displaying it to creating new information or manipulating existing information to see it in new ways. Variables provide storage containers for data. You store the data until you need to use it in the application, take the data out, do something with it, and then put it back into the variable when you’re done. The term variable is appropriate because you can store different data items in a variable — the content is, well, variable. The variable content changes to meet application needs. This chapter helps you understand how variables work in JavaScript and how you can use them to perform tasks within your application.

The chapter divides ...

Get HTML5 Programming 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.