Chapter 3
Building Expressions
IN THIS CHAPTER
Understanding what expressions are
Figuring out numeric expressions
Tying up string expressions
Getting the hang of comparison expressions
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 ...