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 fol
There are the following arithmetic operators supported by the JavaScript language.
Assume variable A holds 10 and variable B holds 20 then:
Here is the original page link.
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:
*
Operator /
Operator %
Operator+
) -
) <<
) >>
) >>>
) <
) >
) <=
) >=
) instanceof
operator in
operator ==
) !=
)===
) !==
) &
, ^
, |
)&&
, ||
)Technically speaking, also the assignment and comma operators are binary.
+ //Add
- //Subtract
/ //Divided By
* //Multiple
% //Modulus
< //Less than
> //Greater than
! //Not
& //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