Operators from mathematical and logical compoutations
There are different type of operators
- Arithmetic Operators
- Assignment Operators
- Comparsion operators 4 . Logical operators
*1. Arithmetic Operators *
- Addition +
- Subraction -
- mutiplication *
- division /
- Modules %
- increment ++
- decrement --
- Exponentiation - ** (this will used for power value like 5 square 2 = 25)
The numbers (in an arithmetic operation) are called operands.
2. Assignment Operators
This will assign values to js varialbes
- Operator Example Same As Result
- = x = y x = y x = 5
- += x += y x = x + y x = 15
- -= x -= y x = x - y x = 5
- *= x *= y x = x * y x = 50
- **= x **= y x = x ** y x = 100000
- /= x /= y x = x / y x = 2
- %= x %= y x = x % y x = 0
- : x: 45 size.x = 45 x = 45
*3 . Logical Assignment operators *
Operator Example Result
&&= true &&= 10 x = 10
||= false ||= 10 x = 10
??= null ??= 10 x = 10
Logical AND is used between two values :
If the first value is true, the second value is assigned.Logical OR is used between two values :
If the first value is false, the second value is assigned.Logical Nullish coalescing assignment operator is used between two values: If the first value is undefined or null, the second value is assigned.
*4.Comprasion Operators *
Operator Description
== equal to
=== equal value and equal type
!= not equal
!== not equal value or not equal type
> greater than
< less than
>= greater than or equal to
<= less than or equal to
NAN stands for Not-a-Number usually the resullt of an invalid math operation
Top comments (0)