DEV Community

muthukumarasamy thangavel
muthukumarasamy thangavel

Posted on

JavaScript Operators

Today we have discuss the operators and also some example task

Different types of Operators
Arithmetic operators
Assignment operators
Comparison operators
logical operators

Arithmetic operators:
Addition - +
Subtraction - -
Multiplication -*
Increment - ++ (pre &post increment)
Decrement - -- (pre &post Decrement)

Assignment Operator: =
this operator is assign in value to variable

In javascript any number add into the string, the number is automatically change in to the string type.
Example:
50 + 8 = 58
7 + "7" = "77"
in javascript subtraction value add in the string value it subtract to value but you will subtract to the letters NaN (Not a Null)
you will get NaN it means (Numeric datatype)
Example:
10-"2"=8
"mohan"-10 =NaN

Multiplication:
In javascript is multiplaction add in to string value is multiply but string letter NaN so same as subtraction
Example:
2*5 = 10
"ram"*10 =NaN

Assignment operators:
All assign the value to the variable using in this o operator
let a = 5
let b = 6

Comparison operator:
In this operator to the value
Ex:
5==5

Increment& decrement Operator:
in this two types pre & post increment and pre & post Decrement operator
ex:
pre and post increment
pre;
++3 = 4
++6 =7
post:
2++
6++
pre and post decrement:
ex:
pre:
--8
--5
post:
9--
5--

Top comments (0)