Like many C-like programming languages, most operators JavaScript are binary or unary, and written in infix notation, i.e. a op b.

Here is list of typical operations:

  • [Assignment][]: a = b, a += b, a |= b, and more
  • [Arithmetic][]: a + b, `a - b
  • String concatenation: a + b
  • [Boolean][]: a && b, a || b, !a
  • [Bitwise][]: a & b, a | b, a ^ b, ~a, a << b, a >> b, a >>> b
  • Function calls: foo(), foo(a, b, c)
  • Increment/Decrement: a++, ++a, a--, --a
  • [Conditional][]: foo ? bar : baz
  • Others: [in][in], [instanceof][instanceof], [typeof][typeof], [new][new]

JavaScript also has comparison operators and property accessors, both of which are explained in more detail in the next slides.

ES2016

ES2016 introduces the [exponentiation operator][pow]:

var result = 5 ** 2; // equivalent to Math.pow(5, 2)