Chapter 3

Using Variables

Key Skills & Concepts

   Understanding Variables

   Why Variables Are Useful

   Defining Variables for Your Scripts

   Understanding Variable Types

   Using Variables in Scripts

Now that you have learned the basics of adding JavaScript to a Web page, it is time to get into the inner workings of the language. Since variables are an important part of JavaScript coding, you will need to know as much as possible about what they are and why they are useful in your scripts. Once you have an understanding of how variables work and what they can do, you will be able to move on to other topics that build on the use of the various types of variables.

In this chapter, you will begin by learning what variables are and why ...

Get JavaScript: A Beginner's Guide, Fifth Edition, 5th Edition 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.