gte()
gte(
value,other):boolean
Checks if value is greater than or equal to 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 or equal to other, else false.
See Alsoβ
Greater than or equal (>=) - MDN
Sinceβ
2.0.0
Also known asβ
gte (Lodash, Ramda) Β· β (es-toolkit, Remeda, Radashi, Effect, Modern Dash, Antfu)
Exampleβ
// β Deprecated approach
gte(3, 1); // => true
gte(3, 3); // => true
gte(1, 3); // => false
// β
Recommended approach
3 >= 1; // => true
3 >= 3; // => true
1 >= 3; // => false
How it works?β
Checks if value is greater than or equal to other.
Deprecated: Use >= operator directly.
Native Equivalentβ
// β gte(a, b)
// β
a >= b
Use Casesβ
Compare greater or equal πβ
Check if first value is greater than or equal to second.
a >= b;
Validate minimumβ
Check minimum requirements.
if (age >= 18) {
console.log('Adult');
}