← Lesson
BitWithBite
JavaScript · Quick Reference

Lesson 4 — Operators Cheat Sheet

JavaScript
In one line: Arithmetic operators perform mathematical calculations. JavaScript supports all the standard math operators plus the powerful exponentiation (**) operator introduced in ES2016.

Key Ideas

1Arithmetic Operators. Arithmetic operators perform mathematical calculations. JavaScript supports all the standard math operators plus the powerful exponentiation (**) operator introduced i...
2Assignment Operators. Assignment operators combine a mathematical operation with assignment into a single shorthand. They make code shorter and more readable.
3Comparison Operators. Comparison operators compare two values and return a boolean (true or false). The most important distinction in JavaScript is between loose equality (==) and strict eq...
4Logical Operators. Logical operators combine boolean expressions. They also support short-circuit evaluation — a powerful pattern used everywhere in real JS code.
5Ternary Operator. The ternary operator is a one-line if/else expression. Syntax: condition ? valueIfTrue : valueIfFalse. It's perfect for simple conditional assignments and JSX in React.

Code Examples

let a = 10, b = 3; console.log(a + b); // 13 — Addition console.log(a - b); // 7 — Subtraction console.log(a * b); // 30 — Multiplication console.log(a / b); // 3.333... — Division console.log(a % b); // 1 — Modulus (remainder) console.log(a **...
let score = 100; score += 10; // score = score + 10 → 110 score -= 5; // score = score - 5 → 105 score *= 2; // score = score * 2 → 210 score /= 3; // score = score / 3 → 70 score %= 8; // score = score % 8 → 6 score **= 2; // score = sco...
let x = 5, y = 10; console.log(x == 5); // true — loose equality (type coercion!) console.log(x === 5); // true — strict equality (NO coercion) console.log(x != 10); // true — loose inequality console.log(x !== y); // true — strict inequality ...