JavaScript operators are special symbols used to perform operations on values and variables. These operations can include arithmetic, comparison, assignment, logic, and more.
+
Addition-
Subtraction*
Multiplication/
Division%
Modulus (remainder)**
Exponentiationlet a = 5; let b = 2; console.log(a + b); // 7 console.log(a % b); // 1 console.log(a ** b); // 25
Used to assign values to variables.
=
Simple assignment+=
, -=
, *=
, etc.let x = 10; x += 5; // x becomes 15
Used to compare two values:
==
Equal to (loose)===
Equal to (strict)!=
Not equal!==
Strict not equal>
, <
, >=
, <=
let a = 5; console.log(a == "5"); // true (type ignored) console.log(a === "5"); // false (type compared)
Used to combine multiple conditions:
&&
AND||
OR!
NOTlet isLoggedIn = true; let isAdmin = false; console.log(isLoggedIn && isAdmin); // false console.log(!isAdmin); // true
Click the button below to see different operators in action:
typeof
→ Tells the data typeinstanceof
→ Checks object type??
→ Nullish coalescing (returns right-hand value if left is null/undefined)?:
→ Ternary operator for quick conditionalslet name; let display = name ?? "Guest"; console.log(display); // Guest
Help others discover Technorank Learning by sharing your honest experience.
Your support inspires us to keep building!