chapter 2

BasicJavaScript

Now that you have had a chance to run some simple JavaScript programs, we're ready for a technical look at the basic elements of the language itself.

2.1 Expressions

We'll start our overview of the language with expressions. An expression is code that is evaluated. Let's evaluate some expressions:

images

Expressions are made up of values, such as 8.1, true, and “dog”, and operators, such as + (addition) and * (multiplication). Every value in JavaScript is either

images   A Boolean (true or false),

   A number,

   A string,

   The ...

Get The JavaScript Programming Language 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.