JavaScript Comparison Operators
Comparison Operators
1] Equal to (==)
2] Equal value and equal type (= = =)
3] Not equal (! =)
4] Not equal value or not equal type (! = =)
5] Greater than ( > )
6] less than (< )
7] Greater than or equal to (> = )
8] less than or equal to (< =)
Example :-
1] Equal to (==)
Check the two value equal or not
Answer is True or False
Two value is equal is = True
Two value is not equal is = False
Example :-
var a=2;var b=2;console.log(a==b);
Output:-
var a=2;
var b=2;
console.log(a==b);
2] Equal value and equal type (= = =)
Check two values are equal and of the same .
Two value is equal is = True
Two value is not equal is = False
Example :-
var a=7;var b="7";console.log(a===b);Output:-
var a=7;
var b="7";
console.log(a===b);
3] Not equal (! =)
Check two values are not equal
than Answer is True
Example :-
var z=7;var y=5;console.log(z!=y);
Output:-
var z=7;
var y=5;
console.log(z!=y);
4] Not equal value or not equal type (! = =)
Example :-
var z=7;var y="7";console.log(z!==y);
Output:-
var z=7;
var y="7";
console.log(z!==y);
5] Greater than ( > )
Example :-
var z=7;var y=5;console.log(z>y);
Output:-
var z=7;
var y=5;
console.log(z>y);
6] less than (< )
Example :-
var z=7;var y=5;console.log(z<y);
Output:-
var z=7;
var y=5;
console.log(z<y);
7] Greater than or equal to (> = )
Example :-
var z=7;var y=5;console.log(z>=y);
Output:-
var z=7;
var y=5;
console.log(z>=y);
8] less than or equal to (< =)
Example :-
var z=7;var y=5;console.log(z<=y);
Output:-
var z=7;
var y=5;
console.log(z<=y);
Post a Comment