- Arithmetic Operators
- Relational Operators
- Bitwise Operators
- Logical Operators
- Assignment Operators
Now we will check all these operators in detail. we will check each category.
Arithmetic Operators are used to performing normal mathematical operations. For example to perform addition, subtraction. We have a total of five operators in this category.
|+||Addition||10+20 = 30|
|–||Subtraction||20-10 = 10|
|*||Multiplication||10*20 = 200|
|/||Division||20/10 = 2|
|%||Modulus||20%10 = 0|
Relational Operators are used to performing check relation between two operands operations. For example, check less than or greater than. We have a total of eight operators in this category.
|==||Is equal to||10==20 = false|
|===||Identical (equal and of same type)||10==20 = false|
|!=||Not equal to||10!=20 = true|
|!==||Not Identical||20!==20 = false|
|>||Greater than||20>10 = true|
|>=||Greater than or equal to||20>=10 = true|
|<||Less than||20<10 = false|
|<=||Less than or equal to||20<=10 = false|
Bitwise Operators are work on the bit level of the operand. We have a total of seven operators in this category.
|&||Bitwise AND||(10==20 & 20==33) = false|
||||Bitwise OR||(10==20 | 20==33) = false|
|^||Bitwise XOR||(10==20 ^ 20==33) = false|
|~||Bitwise NOT||(~10) = -10|
|<<||Bitwise Left Shift||(10<<2) = 40|
|>>||Bitwise Right Shift||(10>>2) = 2|
|>>>||Bitwise Right Shift with Zero||(10>>>2) = 2|
Logical Operators are work between two expressions. We have a total of three operators in this category.
|&&||Logical AND||(10==20 && 20==33) = false|
|||||Logical OR||(10==20 || 20==33) = false|
|!||Logical Not||!(10==20) = true|
Assignment Operators are normally used to assign value to a variable. We have a total of six operators in this category.
|+=||Add and assign||var a=10; a+=20; Now a = 30|
|-=||Subtract and assign||var a=20; a-=10; Now a = 10|
|*=||Multiply and assign||var a=10; a*=20; Now a = 200|
|/=||Divide and assign||var a=10; a/=2; Now a = 5|
|%=||Modulus and assign||var a=10; a%=2; Now a = 0|
Spread the love:
Please share this page on social media with your friends..