Skip to main content

gt()

gt(value, other): boolean

Checks if value is greater than other.

DEPRECATED

Use the > operator directly instead.


Parameters​

value: number​

The value to compare.

other: number​

The other value to compare.


Returns: boolean​

true if value is greater than other, else false.


See Also​

Greater than (>) - MDN


Since​

2.0.0


Also known as​

gt (Lodash, Ramda) · ❌ (es-toolkit, Remeda, Radashi, Effect, Modern Dash, Antfu)


Example​

// ❌ Deprecated approach
gt(3, 1); // => true
gt(3, 3); // => false
gt(1, 3); // => false

// βœ… Recommended approach
3 > 1; // => true
3 > 3; // => false
1 > 3; // => false

How it works?​

Checks if value is greater than other. Deprecated: Use > operator directly.

Native Equivalent​

// ❌ gt(a, b)
// βœ… a > b

Use Cases​

Compare greater than πŸ“Œβ€‹

Check if first value is greater than second.

a > b;

Validate threshold​

Check if value exceeds threshold.

if (score > passingScore) {
console.log('Passed!');
}