Lodash _.gte() method

Beginner
⏱️ 6 min read
📚 Updated: May 2026
🎯 3 Code examples
🚀 3 Try-it labs
Lodash

What you’ll learn

  • How _.gte(value, other) maps to JavaScript’s >= comparison.
  • Why equal values return true (unlike _.gt).
  • Ordering for numbers, strings, and Date values.
  • How NaN and coercion interact with inclusive bounds.

Prerequisites

Comfort with >= and the idea that inclusive comparisons treat equal operands as passing.

  • You can read numeric and string ordering examples.
  • You can open Try-it labs in the browser.

Overview

_.gte is the lodash helper for “at least” checks: minimums, floors, and deadlines where hitting the boundary value should still pass. It mirrors >=, so equality is included.

Inclusive bound

gte(a, b) when a === b or a > b—ideal for thresholds.

Same ordering rules

Numbers, strings, and dates follow the same comparison semantics as > and >=.

Still NaN-safe

Any comparison involving NaN is false; validate numeric inputs first.

Syntax

javascript
_.gte(value, other)
  • value: left-hand side of the comparison.
  • other: right-hand side of the comparison.
  • Returns: true if value >= other under JavaScript rules; otherwise false.
1

Numbers, equality, and strings

_.gte returns true when values are equal or the left side is larger. Lexicographic rules apply to strings.

javascript
import gte from "lodash/gte";

gte(5, 3);            // true
gte(3, 3);            // true  (not true for _.gt)
gte(3, 5);            // false
gte("b", "a");        // true
Try it Yourself
2

Dates: later, equal, and earlier

Two Date objects with the same instant compare as equal, so _.gte passes; a later instant still compares greater.

javascript
import gte from "lodash/gte";

var later = new Date("2020-01-01");
var earlier = new Date("2019-12-31");
var sameAsLater = new Date("2020-01-01");

gte(later, earlier);       // true
gte(later, sameAsLater);   // true
gte(3.14, 3);              // true
Try it Yourself
3

Mixed types and coercion

Relational >= can coerce operands the same way as >. Prefer consistent types in application logic.

javascript
import gte from "lodash/gte";

gte(10, "9");         // true
gte("10", 9);         // true
gte(9, 9);            // true
Try it Yourself

📋 _.gte vs _.gt vs _.lte

MethodMeaning
_.gte(a, b)a >= b (equal or greater)
_.gt(a, b)a > b (strictly greater)
_.lte(a, b)a <= b
_.lt(a, b)a < b

Pitfalls to avoid

Strictness

Need strictly greater?

Use _.gt when equality must fail (for example “must be above” a limit).

NaN

Invalid numbers

_.gte(NaN, x) is always false; do not rely on it for range checks on dirty data.

Locales

Localized text

String ordering is not linguistically correct for user-visible sorting; use collation APIs when needed.

❓ FAQ

Yes. Lodash's gte uses the language's greater-than-or-equal comparison, so the boolean result matches the binary >= operator for the same operands.
_.gte(a, b) is true when a > b or when a and b are ordered as equal (including identical primitives or the same moment for Date objects). _.gt is true only when strictly greater.
Ordered comparisons with NaN are always false in JavaScript, including >= and <=.
Use it for thresholds and inclusive bounds—minimums, deadlines (on or after a date), version floors—where equality should count as passing.

Summary

  • Purpose: greater-than-or-equal in one named call.
  • Semantics: identical to the binary >= operator for the same operands.
  • Next: explore more on Lodash _.isArguments().
Did you know?

_.gte matches the binary >= operator: it returns true when value >= other—so equal operands pass, unlike _.gt.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful