For the More Curious: JavaScript Types
Throughout the chapter, you created variables so you could refer to some data inside your functions. Early on, we told you that strings, numbers, and Booleans are three of the five primitive data types. The other two types are null and undefined.
Table 6.2 summarizes the properties of the five primitive types.
Table 6.2 Primitive data types in JavaScript
Type | Example | Description |
---|---|---|
string | “And you get $100! And you get $100! And…!” | Letters, numbers, or symbols enclosed in matching quotation marks. |
number | 42, 3.14159, -1 | Whole numbers and decimals. |
Boolean | true, false |
The keywords true
and false , corresponding
to logical true and false.
|
null ... |
Get Front-End Web Development: The Big Nerd Ranch Guide 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.