bhylu.com

Advertisements

JS Operators

Operators combine, compare, or change values. Read the operands as well as the operator when predicting a result.

Where to run this

This example uses the JavaScript console playground. Select Run to execute it; the example does not run on this lesson page.

A practical example

JavaScript

const subtotal = 7 * 3;
const hasDiscount = subtotal >= 20;
console.log(subtotal, hasDiscount);

What happens

The subtotal is 21 and hasDiscount is true.