More on JavaScript Operators

Operators

JavaScript has the following types of operators. This section describes the operators and contains information about operator precedence.

  • Assignment operators
  • Comparison operators
  • Arithmetic operators
  • Bitwise operators
  • Logical operators
  • String operators
  • Conditional (ternary) operator
  • Comma operator
  • Unary operators
  • Relational operators

JavaScript has both binary and unary operators, and one special ternary operator, the conditional operator. A binary operator requires two operands, one before the operator and one after the operator:

operand1 operator operand2

For example, 3+4 or x*y.

A unary operator requires a single operand, either before or after the operator:

operator operand

or

operand operator

For example, x++ or ++x.


Source: Mozilla, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators
Creative Commons License This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.