JavaScript has different types of operator, which can be classified by several criteria, such as:
- Number of operands.
- Type of operation.
Number of Operands
In general, there are three types of operators. Most JavaScript operators are binary ones that combine two expressions into a single, more complex expression. A binary operator requires two operands, one before the operator and one after the operator. For example, 13+14 or x*y.
JavaScript also supports a number of unary operators, which convert a single expression into a single more complex expression. A unary operator requires a single operand, either before or after the operator. For example, i-- or ++y.
Finally, JavaScript supports one ternary operator, ?:, which combines the value of three expressions into a single one. A ternary operator requires three operands. For example, (car.color == red) ? result += "got red car" : result += "got car with undefined color.";
Type of operations
There exist many types of operators, such as arithmetic, bitwise, comma, and string ones. They operate three types of operands, that is data types. Let us examine them in details.
Assignment Operators
An assignment operator assigns a value to its left operand based on the value of its right operand. The basic assignment operator is equal (=), which assigns the value of its right operand to its left operand. That is, x = y assigns the value of y to x.
The other assignment operators are shorthand for standard operations, as shown in Table 2
Table 1. Assignment operators

Comparison Operators
A comparison operator compares its operands and returns a logical value based on whether the comparison is true or not. The operands can be numerical or string values. When used on string values, the comparisons are based on the standard lexicographical ordering. They are described in Table 3.
Table 2. Comparison operators
In these examples, assume var1 has been assigned the value 3 and var2 had been assigned the value 4.

Arithmetic Operators
Arithmetic operators take numerical values (either literals or variables) as their operands and return a single numerical value. The standard arithmetic operators are addition (+), subtraction (-), multiplication (*), and division (/). These operators work as they do in other programming languages.
JavaScript provides the arithmetic operators listed in Table 4.
Table 3. Arithmetic Operators
