Lodash _.lte() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Lang

Definition

Checks if value is less than or equal to other. Part of Lodash Lang since 3.9.0 (stable — not deprecated). Note: equal values return true — use _.lt for strict less-than.

Pass the value you want to inspect or convert. Read the return type carefully before you use the result.

Syntax

Call _.lte. Start with this line.

Lodash
_.lte(value, other)
CallWhat it does
_.lte(value, other)Primary signature.
_.lte(value)Check, compare, clone, or convert a value.

Prefer import lte from "lodash/lte" when you want a smaller bundle.

Library declarations
Lodash
_.lte(value, other)

Parameters

ParameterDescription
valueRequired. Left-hand value to compare
otherRequired. Right-hand value to compare

Return Value

Return ValueDescription
*true if value ≤ other, else false

Lodash Examples

Example 1 — Official: Less, Equal, Greater

Less-than-or-equal for three classic pairs.

Lodash
console.log(_.lte(1, 3)); // true
console.log(_.lte(3, 3)); // true
console.log(_.lte(3, 1)); // false
Try It Yourself

How It Works

  1. Less. 1 ≤ 3 → true.
  2. Equal. 3 ≤ 3 → true — boundary included.
  3. Greater. 3 ≤ 1 → false.
  4. Function form. Lodash wraps the comparison as a reusable helper.

Example 2 — lte vs lt

Equals pass only with less-or-equal.

Lodash
console.log(_.lte(3, 3)); // true
console.log(_.lt(3, 3));  // false
Try It Yourself

How It Works

  1. lte. Allows equal values → true.
  2. lt. Requires a strict lower value → equals fail.
  3. Pick. Inclusive upper bounds need lte.
  4. Pair. Same idea as gte vs gt on the other side.

Example 3 — String Comparison

Both-string pairs use lexicographic UTF-16 order.

Lodash
console.log(_.lte("a", "b")); // true
console.log(_.lte("a", "a")); // true
console.log(_.lte("10", "9")); // true   // "1" ≤ "9"
Try It Yourself

How It Works

  1. Letters. "a" comes before "b" → true.
  2. Equal strings. Same text → true.
  3. Digits as text. "10" vs "9" is not numeric — first char "1" is ≤ "9".
  4. Tip. Convert with Number (or _.toNumber) before comparing numeric strings.

Example 4 — NaN Comparisons Are Always False

Ordered compares involving NaN never succeed.

Lodash
console.log(_.lte(NaN, 1)); // false
console.log(_.lte(1, NaN)); // false
console.log(_.lte(NaN, NaN)); // false
Try It Yourself

How It Works

  1. Language rule. NaN ≤ x is always false.
  2. Both sides. Either operand being NaN fails the check.
  3. Not equality. For NaN identity use _.eq.
  4. Guard. Filter with Number.isFinite before ordered compares.

Example 5 — Filter With an Inclusive Upper Bound

Use _.lte as a named predicate with _.filter.

Lodash
var scores = [10, 20, 25, 18];

var capped = _.filter(scores, function (n) {
  return _.lte(n, 20);
});

console.log(capped); // [10, 20, 18]
Try It Yourself

How It Works

  1. Threshold. Keep values where n ≤ 20.
  2. Pass. 10, 20, and 18 succeed — edge included.
  3. Drop. 25 fails.
  4. Why lte. Inclusive caps need ≤, not strict lt.

Browser & Runtime Support

_.lte is a Lodash 3.9+ / 4.x Lang helper. It runs anywhere Lodash runs — modern browsers (via CDN or bundle) and Node.js / Bun / Deno with npm install lodash. Native engines already have ≤; Lodash provides a function form for composition.

✓ Stable · Lodash 3.9.0+

_.lte()

Available in [email protected] full builds and the lodash/lte modular import. Works in evergreen browsers and current Node LTS when Lodash is installed.

100% With Lodash 4.x
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
_.lte Lodash 3.9.0+

Bottom line: Safe for production once Lodash is on the page or in your bundle. Prefer import lte from "lodash/lte" for smaller builds. Named less-than-or-equal helper for inclusive filters and composition.

Frequently Asked Questions

_.lte(value, other) returns true when value is less than or equal to other. Equal values pass — unlike _.lt.
lte is less-than-or-equal. lt is strict less-than. So _.lte(3, 3) is true while _.lt(3, 3) is false. Coercion rules otherwise match.
For typical number pairs, yes. When both args are strings, Lodash keeps string <= (lexicographic). Otherwise both are converted with toNumber before comparing.
Any ordered comparison involving NaN is false in JavaScript. Use Number.isFinite or an explicit NaN check when you need special handling.
Use it for inclusive upper bounds — max scores, ages under-or-equal, deadlines on or before a date — or as a named predicate in callbacks.
Use import lte from "lodash/lte" or require("lodash/lte") so bundlers can tree-shake unused Lodash code. Full build: import _ from "lodash" then _.lte.

Next: _.toArray()

Convert a value to an array.

_.toArray() tutorial →

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.

10 people found this page helpful