4. Simple Variable Types

All programming comes down to taking some action with some data. In this chapter, the focus is on the data side of the equation, represented by variables. Even if you’ve never done any programming, you’re probably familiar with the concept of a variable: a temporary storage container. This chapter starts with the basics of variables in JavaScript, and then covers number, string, and Boolean variables. Along the way you’ll find plenty of real-world code, representing some of the actions you will take with these simple variable types.

Basics of Variables

I think it’s easiest to grasp variables by starting with so-called “simple” variables, also called “primitive” variable types. By simple, I mean variables that only store ...

Get Modern JavaScript: Develop and Design 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.