Types of Javascript Operators tutorial 4

Arithmetic Operators

Addition +

Adding two numbers

 2+2

Subtraction –

 4-2

Multiplication *

4*3 

Division /

9/3 

Modulus % (Remainder)

 4%3

Answer is 1

This is not quotent

Increment ++

 var i = 0 ; 

Lets increase i value by 1

 var i++; 

Decrement —

 var i = 0 ; 

Lets decrease i value by 1

 var i--; 

Assignment Operators

Assign value to a variable

a = 32 

Add one to a variable

a += 1 

minus one from a variable

a -= 1 

Operator Precedence

Order in which operations are performed. You can use brackets to make it easier

String Operators(concatenation)

 

Comparison Operators

Why we use comparison operators ?

Equal ==

2==2;

Strictly equal ===

4===4

Not equla !=

8 != 3

Strictly not equal !==

3 !==2

Greater than >

5 >2

Less than <

4<9

Greater Than or Equal >=

4>=3

Less than or Equal <=

3 <= 4

 

Logical Operators

And &&

X <11 && y >7
Or ||
X <13 || y 8

 

Conditional Statements

if statment

if(3>2){console.log("3 is greater than 2")}

else statment

 if(5>3){console.log("5 is greater than 3")} 
 else{console.log("Dad is not happy")} 

Type Operators

 

Tony BB
 

TonyBB is a Coach , marketer, hypnotist and a founder of RSKVF Production who specializes in providing simple, affordable, and easy to use solutions for Life.

Click Here to Leave a Comment Below 0 comments

Leave a Reply: