Member-only story
Relational Operators in JavaScript
For more questions and answers visit our website at Frontend Interview Questions
Types of Relational Operators
JavaScript provides several relational operators:
- Greater than (
>) - Greater than or equal to (
>=) - Less than (
<) - Less than or equal to (
<=) - Equal to (
==) - Not equal to (
!=) - Strict equal to (
===) - Strict not equal to (
!==)
Greater Than (>)
The greater than operator returns true if the left operand is greater than the right operand.
Example:
let a = 10;
let b = 5;
console.log(a > b); // Output: true
console.log(b > a); // Output: falseIn this example, a is greater than b, so a > b evaluates to true. Conversely, b > a evaluates to false.
Greater Than or Equal To (>=)
The greater than or equal to operator returns true if the left operand is greater than or equal to the right operand.
Example:
let x = 10;
let y = 10;
console.log(x >= y); // Output: true
console.log(x >= 5); //…







