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!');
}