Sitemap
Pravin M

Pravin M

I am a frontend developer with 10+ years of experience Blog :- https://www.frontendinterviewquestions.com

Member-only story

Relational Operators in JavaScript

4 min readJul 29, 2024

--

Press enter or click to view image in full size
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:

  1. Greater than (>)
  2. Greater than or equal to (>=)
  3. Less than (<)
  4. Less than or equal to (<=)
  5. Equal to (==)
  6. Not equal to (!=)
  7. Strict equal to (===)
  8. 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: false

In 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); //…

--

--

Pravin M
Pravin M

Written by Pravin M

I am a frontend developer with 10+ years of experience Blog :- https://www.frontendinterviewquestions.com