Thursday, May 21, 2026
HomeLanguagesJavascriptGreater than(>) Comparison Operator in JavaScript

Greater than(>) Comparison Operator in JavaScript

JavaScript Greater Than(>) Operator is used to compare two operands and return true if the left operand has a higher value than the right operator.

Syntax:

a>b

Example 1: In this example, we will compare String, Number, and Boolean using Greater Than Operator.

Javascript




console.log("3">2);
console.log("2">3);
console.log(true>false);


Output: The String and Boolean values are converted to Numbers and compared.

true
false
true

Example 2: In this example, we will compare BigInt, and other data types Greater Than Operator.

Javascript




console.log(2n>2);
console.log(5n>4);
console.log(undefined>null);
console.log(null>undefined)


Output: Similar to the previous example the data type is converted to number and comparison is performed

false
true
false
false

Supported Browsers:

  • Chrome
  • Edge
  • Firefox
  • Opera
  • Safari

We have a complete list of JavaScript Comparison Operators, to check those please go through, the JavaScript Comparison Operator article

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

3 COMMENTS

Most Popular

Dominic
32514 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6892 POSTS0 COMMENTS
Nicole Veronica
12012 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12107 POSTS0 COMMENTS
Shaida Kate Naidoo
7016 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6975 POSTS0 COMMENTS
Umr Jansen
6963 POSTS0 COMMENTS