DEV Community

Sathish
Sathish

Posted on

Operators in JavaScript

Arithematic Operator:

Addition (+):

This operator is used to summing the two number in program
Ex:

10 + 5 = 15

"10"+5 = 105 >> when adding the string and number addition operator act as a concatination

converting the string number in to number we using the function called parseInt() it convert only string number not a string.

parseInt("10"); -> 10

parseInt("Sathish"); -> it shows the error NaN (Not a Number)

Subtraction (-):

This operator is used to subtracting the two number in program

Ex:

10-5 = 5

"10"-5 = 5

Multiplication(*):

This operator is used to multiplying the two number in program

Division (/):
This operator is used to return the quotent of the division two number

10/2 = 5

Modulus (%):
This operator is used the return the reminder of the division two number

10%2 = 0

Returning the Exponential Value ():

Ex:
2**3 = 8

Post increment operator (++):

let i = 10;
i++;
log(i); -> result : 11

Post Decrement operator (--):

let i = 10;
i--;
log(i); result : 9

Post Decrement operator (++i):
let i = 10;
++i;
log(i); result : 10

Pre Decrement operator (--i):

let i = 10;
--i;
log(i); result : 9

Comparision Operator :

==, ===, > , < , << , >>

**Logical Operator:

**&& - And
|| - Or
!= - Not

Top comments (0)