Operatos | Description | Example |
---|---|---|
== | Equal Value | if a=6, b="6" return true |
=== | Equal Value and Same Type | if a=6, b="6" return false |
< | Less than | if a=6, b=5 a<b return false |
<= | Less than Equal to | if a=6, b=5 a<=b return false |
> | Greater than | if a=6, b=5 a>b return true |
>= | Greater than or Equal to | if a=6, b=5 a>=b return true |
!= | Not Equal Value | if a=6, b="6" a!=b return false |
!== | Not Equal Value or Not Same Type | if a=6, b="6" a!==b return true |
Equal to(==) Comparison Operator
ये operator दो Variables की value को equality के लिए compare करता हैं|
Q :- Equal to (==) Comparison Operator in JavaScript.
Source Code :
<!DOCTYPE html> <html> <head> <title>Equal to (==)</title> </head> <body> <script type="text/javascript"> var a=0,b=0,c=0; a=window.prompt("Enter a Number",5); b=window.prompt("Enter b Number",5); a=parseInt(a); c=(a==b); document.write("a : "+a+" Numeric"+"<br>"); document.write("b : "+b+" String"+"<br>"); document.write("a equal value b : "+c); </script> </body> </html>
Output :-
a : 5 Numeric b : 5 String a equal value b : true
Equal Value and Same Type(===) Comparison Operator
ये operator दो Variables की data type और value को equality के लिए compare करता हैं|
Q :- Equal Value and Same Type(===) Comparison Operator in JavaScript.
Source Code :
<!DOCTYPE html> <html> <head> <title>Equal Value and Same Type(===)</title> </head> <body> <script type="text/javascript"> var a=0,b=0,c=0,d=0,e=0; a=window.prompt("Enter a Number",5); b=window.prompt("Enter b Number",5); c=window.prompt("Enter c Number",5); a=parseInt(a); c=parseInt(c); d=(a===b); e=(a===c); document.write("a : "+a+" Numeric"+"<br>"); document.write("b : "+b+" String"+"<br>"); document.write("c : "+c+" Numeric"+"<br>"); document.write("a equal value and same type b : "+d+"<br>"); document.write("a equal value and same type c : "+e); </script> </body> </html>
Output :-
a : 5 Numeric b : 5 String c : 5 Numeric a equal value and same type b : false a equal value and same type c : true
Less than (<) Comparison Operator
ये operator दो Variables में से left side के variable से right side का variable छोटा हैं या नहीं यह check करता हैं|
Q :- Less than (<) Comparison Operator in JavaScript.
Source Code :
<!DOCTYPE html> <html> <head> <title>Less than (<)</title> </head> <body> <script type="text/javascript"> var a=0,b=0,c=0; a=window.prompt("Enter a Number",6); b=window.prompt("Enter b Number",5); a=parseInt(a); b=parseInt(b); c=(a<b); document.write("a : "+a+"<br>"); document.write("b : "+b+"<br>"); document.write("a less than b : "+c+"<br>"); </script> </body> </html>
Output :-
a : 6 b : 5 a less than b : false
Less than equal to (<=) Comparison Operator
ये operator दो Variables में से left side के variable से right side का variable छोटा या बराबर हैं या नहीं यह check करता हैं|
Q :- Less than equal to (<=) Comparison Operator in JavaScript.
Source Code :
<!DOCTYPE html> <html> <head> <title>Less than equal to (<=)</title> </head> <body> <script type="text/javascript"> var a=0,b=0,c=0; a=window.prompt("Enter a Number",5); b=window.prompt("Enter b Number",6); a=parseInt(a); b=parseInt(b); c=(a<=b); document.write("a : "+a+"<br>"); document.write("b : "+b+"<br>"); document.write("a less than equal to b : "+c+"<br>"); </script> </body> </html>
Output :-
a : 5 b : 6 a less than equal to b : true
Greater than (>) Comparison Operator :
ये operator दो Variables में से right side के variable से left side का variable बड़ा हैं या नहीं यह check करता हैं|
Q :- Greater than (>) Comparison Operator in JavaScript.
Source Code :
<!DOCTYPE html> <html> <head> <title>Greater than (>)</title> </head> <body> <script type="text/javascript"> var a=0,b=0,c=0; a=window.prompt("Enter a Number",5); b=window.prompt("Enter b Number",6); a=parseInt(a); b=parseInt(b); c=(a>b); document.write("a : "+a+"<br>"); document.write("b : "+b+"<br>"); document.write("a greater than b : "+c+"<br>"); </script> </body> </html>
Output :-
a : 5 b : 6 a greater than b : false
Greater than equal to (>=) Comparison Operator
ये operator दो Variables में से right side के variable से left side का variable बड़ा या बराबर हैं या नहीं यह check करता हैं|
Q :- Greater than equal to (>=) Comparison Operator in JavaScript.
Source Code :
<!DOCTYPE html> <html> <head> <title>Greater than equal to (>=)</title> </head> <body> <script type="text/javascript"> var a=0,b=0,c=0; a=window.prompt("Enter a Number",5); b=window.prompt("Enter b Number",6); a=parseInt(a); b=parseInt(b); c=(a>=b); document.write("a : "+a+"<br>"); document.write("b : "+b+"<br>"); document.write("a greater than equal to b : "+c+"<br>"); </script> </body> </html>
Output :-
a : 5 b : 6 a greater than equal to b : false
Not Equal to(!=) Comparison Operator
ये operator दो Variables की value equal हैं या नहीं यह check करता हैं|
Q :- Not Equal to (!=) Comparison Operator in JavaScript.
Source Code :
<!DOCTYPE html> <html> <head> <title>Not Equal to (!=)</title> </head> <body> <script type="text/javascript"> var a=0,b=0,c=0,str=0,int=0,nstr=0,nint=0; a=window.prompt("Enter a Number",5); b=window.prompt("Enter b Number",5); c=window.prompt("Enter c Number",5); b=parseInt(b); c=parseInt(c); // Equal to str=(a==b); int=(b==c); // Not Equal to nstr=(a!=b); nint=(b!=c); document.write("<u>Equal to Condition</u>"+"<br>"); document.write("a : "+a+"String"+"<br>"); document.write("b : "+b+"Integer"+"<br>"); document.write("c : "+c+"Integer"+"<br>"); document.write("a equal to b : "+str+"<br>"); document.write("b equal to c : "+int+"<br><br>"); document.write("<u>Not Equal to Condition</u>"+"<br>"); document.write("a : "+a+"String"+"<br>"); document.write("b : "+b+"Integer"+"<br>"); document.write("c : "+c+"Integer"+"<br>"); document.write("a not equal to b : "+nstr+"<br>"); document.write("b not equal to c : "+nint+"<br>"); </script> </body> </html>
Output :-
Equal to Condition a : 5String b : 5Integer c : 5Integer a equal to b : true b equal to c : true Not Equal to Condition a : 5String b : 5Integer c : 5Integer a not equal to b : false b not equal to c : false
Not Equal Value or Not Same type(!==) Comparison Operator
ये operator दो Variables की data type और उसकी value equal हैं या नहीं यह check करता हैं|
Q :- Not Equal Value or Not Same type(!==) Comparison Operator in JavaScript.
Source Code :
<!DOCTYPE html> <html> <head> <title>Not Equal Value or Not Same type(!==)</title> </head> <body> <script type="text/javascript"> var a=0,b=0,c=0,str=0,int=0,nstr=0,nint=0; a=window.prompt("Enter a Number",5); b=window.prompt("Enter b Number",5); c=window.prompt("Enter c Number",5); b=parseInt(b); c=parseInt(c); // Equal to or same type str=(a===b); int=(b===c); // Not Equal to or not same type nstr=(a!==b); nint=(b!==c); document.write("<u>Equal Value or Same Type Condition</u>"+"<br>"); document.write("a : "+a+"String"+"<br>"); document.write("b : "+b+"Integer"+"<br>"); document.write("c : "+c+"Integer"+"<br>"); document.write("a equal value or same type b : "+str+"<br>"); document.write("b equal value or same type c : "+int+"<br><br>"); document.write("<u>Not Equal Value or Not Same Type</u>"+"<br>"); document.write("a : "+a+"String"+"<br>"); document.write("b : "+b+"Integer"+"<br>"); document.write("c : "+c+"Integer"+"<br>"); document.write("a not equal value or not same type b : "+nstr+"<br>"); document.write("b not equal value or not same type c : "+nint+"<br>"); </script> </body> </html>
Output :-
Equal Value or Same Type Condition a : 5String b : 5Integer c : 5Integer a equal value or same type b : false b equal value or same type c : true Not Equal Value or Not Same Type a : 5String b : 5Integer c : 5Integer a not equal value or not same type b : true b not equal value or not same type c : false
Post a Comment
If you have any doubts,Please let me know