Favorites

JavaScript > Greater than Operator

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
>
JavaScript Comparison OperatorThis operator is supported by all modern browsers.
Updated 28th November 2026

The greater than operator (>) checks whether the left value is larger than the right one.

Description

The greater than operator > returns true if the left operand is larger. Numbers compare numerically, but two strings compare character by character by their UTF-16 codes, so '10' > '9' is false and 'a' > 'B' is true. A string and a number are compared as numbers. Any comparison with NaN is false.

When one operand is a string and the other a number, the string is converted to a number, so '10' > 9 is true. Objects are converted to primitives first, which is why dates can be compared directly as timestamps. BigInts and numbers can be compared with each other, such as 10n > 5.

For sorting or comparing words alphabetically in a way that respects language rules, use localeCompare() or Intl.Collator rather than > on strings.

Properties

Operator
>
Category
Comparison
Precedence
9 (1 is lowest, 18 is highest)
Associativity
left-to-right

Syntax

x > y

Example

console.log(5 > 3);
console.log('10' > '9');
console.log('10' > 9);
console.log('b' > 'a');
console.log(NaN > 0);

Browser Support

The following information will show you the current browser support for the > operator. Hover over a browser icon to see the version that first introduced support for this operator.

This operator is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee