You are previewing Eloquent JavaScript.

Eloquent JavaScript

Cover of Eloquent JavaScript by Marijn Haverbeke Published by No Starch Press
O'Reilly logo

Chapter 1. Basic JavaScript: Values, Variables, and Control Flow

Inside the computer’s world, there is only data—that which is not data does not exist. All this data is in essence just sequences of bits and is thus fundamentally alike. Bits are any kinds of two-valued things, usually described as 0s and 1s. Inside the computer, they take forms like a high or low electrical charge, a strong or weak signal, or a shiny or dull spot on the surface of a CD.


Though made of the same uniform stuff, every piece of data plays its own role. In a JavaScript system, most of this data is neatly separated into things called values. Every value has a type, which determines the kind of role it can play. There are six basic types of values: numbers, strings, ...

The best content for your career. Discover unlimited learning on demand for around $1/day.