Lodash _.reject() method

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

What you’ll learn

  • How _.reject(collection, predicate) omits elements where the predicate is truthy—the inverse of filter.
  • Iteratee shorthands (functions, paths, partial matches) identical to other Lodash collection APIs.
  • Arrays versus plain objects, and when partition saves a second pass.
  • Try each example in the editor (?tryit=1, 2, 3) with Lodash from a CDN.

Prerequisites

Read _.filter() first—the predicate means the same thing; only kept versus dropped flips.

  • You are comfortable with predicates that return truthy or falsy values.
  • You can open Try-it labs or run snippets locally.

Overview

_.reject trims collections by exclusion—drop positives, strip archived rows, or peel outliers—without flipping predicate logic at every call site.

Complement of filter

Truthiness still decides fate—truthy removes an element; falsy keeps it in the new array.

Iteratee toolbox

Lambdas, property strings, and matcher objects work exactly like filter.

Objects included

Reject from keyed records with the same (value, key, collection) callback shape.

Syntax

javascript
_.reject(collection, predicate)
  • collection: array, array-like, or plain object Lodash can iterate.
  • predicate: invoked as (value, index|key, collection); truthy means the value is excluded from the result.
  • Returns: always an array (possibly empty) of surviving elements or values.
1

Drop positives from an array

Elements where n > 0 are removed; zero and negatives remain—mirror image of a positivity filter.

javascript
import reject from "lodash/reject";

reject([-2, 0, 3, 7], (n) => n > 0);
// → [-2, 0]
Try it Yourself
2

Remove archived records with a matcher

Shorthand objects reject rows that satisfy the partial match—here, anything with archived: true disappears.

javascript
import reject from "lodash/reject";

reject(
  [
    { id: 1, role: "admin", archived: false },
    { id: 2, role: "viewer", archived: true },
    { id: 3, role: "editor", archived: false }
  ],
  { archived: true }
);
// → rows without archived: true
Try it Yourself
3

Reject large values from a plain object

Keys drive iteration only—the output stays an array of retained values, same as filter.

javascript
import reject from "lodash/reject";

reject({ min: 5, mid: 15, max: 40 }, (v) => v >= 10);
// → [5]
Try it Yourself

📋 _.reject vs filter, partition, negated predicates

APIOutcomeBest when
_.reject(collection, predicate)Array without truthy predicate hitsExclusion reads clearer than wrapping predicates in !
_.filter(collection, predicate)Array of matchesYou phrase logic as what to keep
_.partition(collection, predicate)[matches, rejects]You need both buckets in one pass
array.filter((x) => !pred(x))Array without matchesNo Lodash iteratee sugar on arrays

Pitfalls to avoid

Shape

Lost keys on objects

Rejecting over an object still yields an array of values—use entries helpers when keys must survive.

Perf

Double predicates

Calling both filter and reject on the same collection evaluates the predicate twice—prefer partition.

Truthy

Ambiguous predicates

JavaScript truthiness can surprise—return explicit booleans when reviewing edge cases.

❓ FAQ

No. Lodash builds a new array of survivors; the original array or object stays unchanged.
An array of values where the predicate was falsy—same shape caveat as filter: keys are not preserved in the result.
reject(collection, pred) matches filter(collection, (v,i,c) => !pred(v,i,c)) for typical predicates—reject avoids noisy negations at call sites.
partition yields [matches, rejects] in one traversal; separate filter+reject runs the predicate twice.
Yes—reject removes elements where the shorthand matches (predicate truthy), same conventions as filter.

Summary

  • Purpose: _.reject(collection, predicate) returns elements where the predicate is falsy—the inverse selection of filter.
  • Contrast: use partition when both keep and drop lists matter in one traversal.
  • Next: Lodash _.sample(), Lodash _.reduceRight() (previous), or collection hub.
Did you know?

_.reject(collection, predicate) is literally the inverse selection of filter with the same predicate—elements dropped by one appear in the other. Prefer whichever reads clearer and pair with partition when you need both buckets in one pass.

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