Add Additional Logic

Learn about logical operators and play with them

“And” operator

Suppose you want to check if a number is between 0 and 100. You’re essentially checking if it’s “greater than or equal to 0” and “less than or equal to 100”. Both sub-conditions must be satisfied at the same time.

The expression 0 <= number <= 100 is correct from a mathematical point of view but cannot be written in JavaScript (neither in most other programming languages).

Here’s how you’d translate that same check into JS.

Get hands-on with 1400+ tech skills courses.