Chapter 3

Building Expressions

IN THIS CHAPTER

Bullet Understanding what expressions are

Bullet Figuring out numeric expressions

Bullet Tying up string expressions

Bullet Getting the hang of comparison expressions

Bullet Learning about logical expressions

When coding in JavaScript, you use expressions constantly, so it’s vital to understand what they are and to get comfortable with the types of expressions that are available to you. Every JavaScript coder is different, but I can say without fear of contradiction that every good JavaScript coder is fluent in expressions.

This chapter takes you through everything you need to know about expressions. You discover some expression basics and then explore a number of techniques for building powerful expressions using numbers, strings, and Boolean values.

Understanding How Expressions Are Structured

A JavaScript expression takes one or more inputs, such as a bill total and a tip percentage, and combines them in some way — for example, by using multiplication. In expression ...

Get JavaScript Essentials For Dummies 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.