Chapter 5

Working with Operators, Expressions, and Statements

IN THIS CHAPTER

Bullet Reading and coding JavaScript expressions

Bullet Changing values with assignment operators

Bullet Thinking logically with comparison operators

Bullet Doing the math with arithmetic operators

Bullet Getting wise to bitwise operators

Bullet Putting it together with string operators

“Hello Operator. Can you give me number 9?”

— THE WHITE STRIPES

JavaScript operators, expressions, and statements are the basic building blocks of programs. They help you manipulate and change values, perform math, compare two or more values, and much, much more.

In this chapter, you discover how operators, expressions, and statements do their work and how you can best use them to your advantage.

Express Yourself

An expression is a piece of code that resolves to a value. Expressions can either assign a value to a variable, or they can simply have a value. For example, ...

Get Coding All-in-One For Dummies, 2nd 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.