Skip to content
AgileLogics
4 min read

Operators

Prerequisites: Numbers, Boolean values

Arithmetic operators: + - * / % **. Comparison operators: == != > < >= <=, plus strict versions === !==. Logical operators: && || !.

0 == "0"    // true  — loose comparison, converts types first
0 === "0"   // false — strict comparison, checks type and value

const age = 20;
age >= 18 && age < 65   // true

Common mistakes

  • Using ==/!= instead of ===/!==. Loose equality's type coercion rules are notoriously easy to get wrong ([] == false is true, for example) — always prefer the strict versions.