JavaScript operators are the symbols, such as ===, ??, and ?., that compute a result from one or more values. This area gives each operator, or each family of closely related operators, a short entry with its syntax, a runnable example, and the edge cases that trip readers up. The set follows MDN’s Expressions and operators index and grows only when a new operator reaches Stage 4 at TC39.
Operator-like syntax, such as spread syntax and destructuring, has entries here too. These entries help most when a line of code hinges on one symbol, such as whether ?? keeps a 0, what ?. returns for a missing property, or when && skips its right side.
Topics covered include:
Property access: The syntax for reading properties by name or computed key (property accessors (., []), optional chaining (?.))
Logical operators: The operators that test values and pick between operands (logical AND (&&), logical OR (||), nullish coalescing (??))
Equality and comparison: The operators that compare two values (equality operators (==, ===), comparison operators (<, >, <=, >=))
Arithmetic: The operators for math on numbers and bigints (arithmetic operators (+, -, *, /, %), exponentiation (**))
Bitwise and shift: The operators that work on the bits of numbers and bigints (bitwise operators (&, |, ^, ~), shift operators (<<, >>, >>>))
Assignment and destructuring: The syntax for storing values (assignment operators (=, +=), logical assignment (&&=, ||=, ??=), destructuring)
Other operator syntax: The remaining symbols in MDN’s operator index (spread syntax (...), ternary operator (? :), comma operator (,))
Evaluation rules: The rules for the order and extent of evaluation (operator precedence, short-circuit evaluation)
Operators spelled as words, such as typeof, instanceof, in, and delete, live in JavaScript Keywords. Arrow functions, template literals, and concepts such as truthy values and type coercion live in the JavaScript Glossary.
The types that operators act on have their own entries in JavaScript Primitive Types, and objects such as Math are covered in Standard Built-in Objects. The idea of a falsy value is defined in the Glossary, while this area explains how ||, &&, and ! act on it.
Not sure which term you need? Describe what you’re trying to do, and Mentor AI will point you to the right entries.
arithmetic operators (+, -, *, /, %)A family of operators that add, subtract, multiply, divide, or take the remainder of numbers and bigints, where + also joins strings.
assignment operators (=, +=)A family of operators that store a value in a variable or property, where compound forms like += first combine it with the current value.
bitwise operators (&, |, ^, ~)A family of operators that combine or invert the bits of integers, as 32-bit values for numbers and in full for bigints.
comma operator (,)An operator that evaluates its operands from left to right and returns the value of the last one, discarding the others.
comparison operators (<, >, <=, >=)A family of operators that test whether one value is less than or greater than another, comparing strings by UTF-16 code units.
destructuringA syntax that unpacks array elements or object properties into separate variables, with optional defaults, renaming, and rest elements.
equality operators (==, ===)A family of operators that test two values for loose equality, with type conversion, or strict equality, without it.
exponentiation (**)An operator that raises a number or bigint to a power, grouping from the right, where a unary minus before the base is a syntax error.
increment and decrement (++, --)A pair of operators that add or subtract one from a variable or property, where the prefix form returns the new value and the postfix form the old one.
logical AND (&&)An operator that returns its first falsy operand, or its last operand when all are truthy, and skips evaluating the rest.
logical assignment (&&=, ||=, ??=)A family of assignment operators that write a new value only when the current one is truthy, falsy, or null or undefined.
logical NOT (!)An operator that converts its operand to a Boolean and returns the opposite, so it returns true for falsy values and false for truthy ones.
logical OR (||)An operator that returns its first truthy operand, or its last operand when none is truthy.
nullish coalescing (??)An operator that returns its right operand only when the left one is null or undefined, so 0, empty strings, and false pass through.
operator precedenceA rule that decides how JavaScript groups the operators in an expression without parentheses, using precedence levels and associativity.
optional chaining (?.)An operator that reads a property or calls a function only if the value before it isn’t null or undefined, and returns undefined otherwise.
property accessors (., [])A family of operators, dot notation and bracket notation, that read or write an object property by a fixed name or a computed key.
shift operators (<<, >>, >>>)A family of operators that move the bits of a 32-bit integer or a bigint left or right, filling with zeros or copies of the sign bit.
short-circuit evaluationA rule that stops evaluating an expression once the left operand decides the result, used by &&, ||, ??, ?., and logical assignment.
spread syntax (...)A syntax that expands an iterable into separate elements or arguments, or copies an object’s own properties into a new object.
ternary operator (? :)An operator that evaluates a condition and returns one of two expressions, the first when the condition is truthy and the second when it’s falsy.
unary plus and negation (+, -)A pair of operators that convert a single operand to a number, where + keeps the value and - flips its sign, and only - accepts bigints.
Get a JavaScript Cheat Sheet (PDF), a printable reference to variables, types, strings, arrays, objects, functions, classes, modules, and async basics: