JavaScript Relational Operators
Notes:
JavaScript Relational Operators :
Relational operators are also known as comparison operators.
They are used find the relationship between two values or compare relationship between two values; on comparison they yield the result true or false.
< : less than Operator
> : greater than Operator
<= : less than or equal to Operator
>= : greater than or equal to Operator
== : equal to Operator
!= : not equal to Operator
=== : strictly equal to Operator
!== : strictly not equal to Operator
document.write("Relational Operators");
document.write(3 < 4); //true
document.write(5 < 4); // false
document.write(5 > 4); // true
document.write(5 > 6); // false
document.write(5 <= 6); // true
document.write(6 <= 6); // true
document.write(7 <= 6); // false
document.write(7 >= 6); // true
document.write(6 >= 6); // true
document.write(5 >= 6); // false
document.write(5 == 6); // false
document.write(5 == 5); // true
document.write(5 == "5"); // true
document.write(5 === "5"); // false
document.write(5 != 6); // true
document.write(5 != "5"); // false
document.write(5 !== "5"); // true
document.write(“Hello” == “Hello”);// true
Interview Questions:
1. Which operator is not a relational operator ?
a. <
b. =
c. >
d. !=
Answer: b