All TalkersCode Topics

Follow TalkersCode On Social Media

devloprr.com - A Social Media Network for developers Join Now ➔

Javascript Operators

Operators are used to perform some operations between variables.Javascript has different kind of operators for different purpose.



Arithmetic Operators

Arithmetic operators are those operators which are used to perform operations between generally numeric values.

OperatorDescription
+It is called Addition Operator it is used to add two or more variables. For eg. var x + var y.
-It is called Subtraction Operator it is used to get the difference of the two or more variables. For eg. var x - var y.
*It is called Multiplication Operator it is used to get the product of two or more variables. For eg. var x * var y.
/It is called Division Operator it is used to get the quotient of two or more variables. For eg. var x / var y.
%It is called Modulus Operator it is used to get the remainder of two or more variables. For eg. var x % var y.
var x++It is called Post-Increment Operator it is used to return var x then increase the variable value by 1
var x--It is called Post-Decrement Operator it is used to return var x then decrease the variable value by 1



Assignment Operators

Assignment operators are those operators which are used to set values to a variables.


OperatorDescription
var x=var yIt is used to to asign the values to the variable. For eg. var x=100;
var x+=var yIt is same as var x=var x+var y
var x-=var yIt is same as var x=var x-var y
var x*=var yIt is same as var x=var x*var y
var x/=var yIt is same as var x=var x/*var y
var x%=var yIt is same as var x=var x%var y



Comparison Operators

Cmparison operators are those operators which are used to compare two values.


OperatorDescription
var x==var yIt is called Equal Operator it returns true if var x is equal to var y
var x!=var yIt is called Not Equal Operator it returns true if var x is not equal to var y.
>It is called Greater Than Operator it returns true if var x is greater than var y.
<It is called Less Than Operator it returns true if var x is less than var y.
>=It is called Greater Than or Equal To Operator it returns true if var x is greater than or equal to var y.
<=It is called Less Than or Equal To Operator it returns true if var x is less than or equal to var y.



Logical Operators

Logical operators are those operators which are used to combine conditional statements.


OperatorDescription
var x and var yIt is same as var x && var y. It is called And Operator it returns true if var x and var y are true
var x or var yIt is same as var x || var y. It is called Or Operator it returns true if one of then is true.
!var xIt is called Not Operator it returns true if var x is not true.
❮ PreviousNext ❯