List of all binary operators in JavaScript
javascript, operators
Solution
You will find a complete list in the specification, in the expression chapter. Because the most "normal" operators are binary (see the definition at Wikipedia), they are not explicitly listed as such (like the unary and ternary operators). They are:
- Multiplicative Operators
- The `*` Operator
- The `/` Operator
- The `%` Operator
- Additive Operators
- The Addition operator (`+`)
- The Subtraction Operator (`-`)
- Bitwise Shift Operators
- The Left Shift Operator (`<<`)
- The Signed Right Shift Operator (`>>`)
- The Unsigned Right Shift Operator (`>>>`)
- Relational Operators
- The Less-than Operator (`<`)
- The Greater-than Operator (`>`)
- The Less-than-or-equal Operator (`<=`)
- The Greater-than-or-equal Operator (`>=`)
- The `instanceof` operator
- The `in` operator
- Equality Operators
- The Equals Operator (`==`)
- The Does-not-equals Operator (`!=`)
- The Strict Equals Operator (`===`)
- The Strict Does-not-equal Operator (`!==`)
- Binary Bitwise Operators (`&`, `^`, `|`)
- Binary Logical Operators (`&&`, `||`)
Technically speaking, also the assignment and comma operators are binary.
Problem
I am trying to understand what is possible with binary operators (only binary operators) in JavaScript. So far the list of binary operators I have discovered are the the following. They are primarily sourced from this list, but are any missing? Note, I am after specifically only binary operators which, according to the source listed above, is defined as binary operators you use with two objects (is this accurate?). I have also added the additions from @zessx. ``` + //Add - //Subtract / //Divided by * //Multiple % //Modulus < //Less than > //Greater than & //AND | //OR ^ //XOR ~ //Invert each bits << //Move all bits onto the left >> //Move all bits onto the right >>> //Move all bits onto the right and fill left end with 0 ```