Operators and Expressions

JavaScript supports various operators to perform operations on variables and values.

  • Arithmetic: +, -, *, /, %, **
  • Assignment: =, +=, -=, etc.
  • Comparison: ==, ===, !=, >, <, etc.
  • Logical: &&, ||, !
  • Type: typeof, instanceof

Expressions are any valid unit of code that resolves to a value.

let sum = 5 + 3;
let isAdult = age >= 18;

Note: Use === instead of == to avoid type coercion bugs.

← PrevNext →