Lodash _.lt() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Lang

Definition

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

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

Syntax

Call _.lt. Start with this line.

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

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

Library declarations
Lodash
_.lt(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

Strict less-than for three classic pairs.

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

How It Works

  1. Less. 1 < 3 → true.
  2. Equal. 3 < 3 is false — not less.
  3. Greater. 3 < 1 → false.
  4. Function form. Lodash wraps the comparison as a reusable helper.

Example 2 — lt vs lte

Equals pass only with less-or-equal.

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

How It Works

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

Example 3 — String Comparison

Both-string pairs use lexicographic UTF-16 order.

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

How It Works

  1. Letters. "a" comes before "b" → true.
  2. Reverse. "b" < "a" → false.
  3. Digits as text. "10" vs "9" is not numeric — first char "1" beats "9" as “less”.
  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(_.lt(NaN, 1)); // false
console.log(_.lt(1, NaN)); // false
console.log(_.lt(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 Numbers Less Than a Threshold

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

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

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

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

How It Works

  1. Threshold. Keep values where n < 20.
  2. Pass. 10 and 18 succeed.
  3. Drop. 25 and 30 fail.
  4. Why lt. Named helper reads clearly next to other Lodash lang predicates.

Browser & Runtime Support

_.lt 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+

_.lt()

Available in [email protected] full builds and the lodash/lt 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
_.lt Lodash 3.9.0+

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

Frequently Asked Questions

_.lt(value, other) returns true when value is strictly less than other. It uses the same relational comparison idea as JavaScript’s < operator (Lodash coerces non-string pairs via toNumber).
For typical number pairs, yes. When both args are strings, Lodash keeps string < (lexicographic). Otherwise both are converted with toNumber before comparing.
lt is strict less-than. lte is less-than-or-equal, so _.lte(3, 3) is true while _.lt(3, 3) is false.
Any ordered comparison involving NaN is false in JavaScript. Use Number.isFinite or an explicit NaN check when you need special handling.
Like < on strings: UTF-16 code unit order, not locale-aware collation. Prefer Intl.Collator for human language sorting.
Use import lt from "lodash/lt" or require("lodash/lt") so bundlers can tree-shake unused Lodash code. Full build: import _ from "lodash" then _.lt.

Next: _.lte()

Check whether one value is less than or equal to another.

_.lte() tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

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