fak*_*ood 11 javascript operators
我试图理解JavaScript中二进制运算符(只有二元运算符)的可能性.到目前为止,我发现的二元运算符列表如下.它们主要来自此列表,但是有什么遗漏?
注意,我特意只使用二元运算符,根据上面列出的源,它被定义为与两个对象一起使用的二元运算符(这是否准确?).我还添加了@samsamX的附加内容.
+ //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
Run Code Online (Sandbox Code Playgroud)
Ber*_*rgi 13
您将在表达式章节中的规范中找到完整列表.因为最"正常"的运算符是二进制的(参见维基百科的定义),所以它们没有明确地列出(如一元和三元运算符).他们是:
*运营商/运营商%运营商+)-)<<)>>)>>>)<)>)<=)>=)instanceof运营商in运营商==)!=)===)!==)&,^,|)&&,||)从技术上讲,赋值和逗号运算符也是二进制的.