当前位置:网站首页>JS foundation -- Operator

JS foundation -- Operator

2022-06-11 09:38:00 Snatch bamboo shoots 123

Arithmetic operator

A symbol that performs a series of operations

Operator describe
+ Add
- Subtraction
* Multiplication
/ division
% modulus ( remainder )
++ Self increasing
Self reduction

Comparison operator

Operator describe
== be equal to
=== Absolutely equal to ( Values and types are equal )
!= It's not equal to
!== Not absolutely equal to ( There is an inequality between value and type , Or two are not equal )
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to

Note the === and "!==", Both are js A special comparison operator in

Assignment operator

Operator describe
=x=y
+=x+=y
-=x-=y
*=x*=y
/=x/=y
%=x%=y

Logical operators

Operator describe
&&and
|or
!not

Conditional operator

A special ternary operator , The format is as follows

var num=a?b:c;

In the above sentence num The values of are as follows
n u m = { b , a by really c , a by false num= \begin{cases} b,a It's true \\ c,a For false \end{cases} num={ b,a by really c,a by false

An operator

Operator describe
& And
| or
^ Exclusive or
~ Not
<< Move left
>> Move right
>>> fill 0 Move right
原网站

版权声明
本文为[Snatch bamboo shoots 123]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206110914078580.html