CHAPTER 3Data Types and Variables

The basic types that JavaScript supports include numbers, strings, and Booleans. More complex types such as objects, arrays, and functions are also part of the language. This chapter covers in detail the basic data types and their usage. Functions and composite types, such as objects, are also briefly introduced, but a complete exposition of their capabilities is reserved for Chapters 5 and 6.

Key Concepts

A variable can be thought of as a container that holds data. It’s called a “variable” because the data it contains—its value —varies. For example, you might place the total price of items a customer is buying in a variable and then add tax to this amount, storing the result back in the variable.

The type of ...

Get JavaScript The Complete Reference, 3rd 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.