Lodash _.remove() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Array

Definition

Removes every element for which predicate returns truthy and returns a new array of those removed values. Part of Lodash 4.x Array.

Warning: Unlike _.filter, this method mutates array. Prefer _.pull when you already know the exact values to strip.

Syntax

Call _.remove on an array. Start with this line.

Lodash
_.remove(array, [predicate=_.identity])
CallWhat it does
_.remove(array, [predicate=_.identity])Primary signature.
_.remove(array)Call with an array argument.

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

Library declarations
Lodash
_.remove(array, [predicate=_.identity])

Parameters

ParameterDescription
arrayRequired. Array to mutate
predicateOptional. Defaults to _.identity

Return Value

Return ValueDescription
*New array of removed values

Lodash Examples

Example 1 — Official: Remove Evens

Predicate removes even numbers; return holds the evens.

Lodash
var array = [1, 2, 3, 4];
var evens = _.remove(array, function (n) {
  return n % 2 == 0;
});

console.log(array);
// → [1, 3]

console.log(evens);
// → [2, 4]
Try It Yourself

How It Works

  1. Predicate. n % 2 == 0 is truthy for evens.
  2. Collect. 2 and 4 go into evens.
  3. Mutate. Source shrinks to [1, 3].
  4. Return. evens is a new array — not the same as array.

Example 2 — Matches Object Shorthand

Pass a partial object — Lodash removes deep-matching items.

Lodash
var array = [
  { n: 1, active: true },
  { n: 2, active: false },
  { n: 3, active: true }
];

var removed = _.remove(array, { active: false });
// array   → [{ n: 1, active: true }, { n: 3, active: true }]
// removed → [{ n: 2, active: false }]
Try It Yourself

How It Works

  1. Shorthand. { active: false } becomes a matches predicate.
  2. Match. Only the middle object qualifies.
  3. Remove. Inactive row leaves; active rows stay.
  4. Handy. Same idea as _.filter matches — but mutating.

Example 3 — Property Shorthand

A string property removes items where that property is truthy.

Lodash
var array = [
  { name: "a", on: true },
  { name: "b", on: false },
  { name: "c", on: true }
];

var removed = _.remove(array, "on");
// array   → [{ name: "b", on: false }]
// removed → [{ name: "a", on: true }, { name: "c", on: true }]
Try It Yourself

How It Works

  1. Property. "on" means “remove if item.on is truthy”.
  2. Truthy. a and c leave.
  3. Falsy stays. b with on: false remains.
  4. Careful. Truthy numbers/strings on that key also get removed.

Example 4 — No Matching Elements

If the predicate never returns truthy, nothing is removed.

Lodash
var array = [1, 2, 3];
var removed = _.remove(array, function (n) {
  return n > 9;
});

// array   → [1, 2, 3]
// removed → []
Try It Yourself

How It Works

  1. Test. Nothing is greater than 9.
  2. Empty return. removed is [].
  3. Unchanged. Source length and contents stay the same.
  4. Safe. Missing matches do not throw.

Example 5 — remove vs filter

Same predicate, different return and mutation story.

Lodash
var a = [1, 2, 3, 4];
var b = [1, 2, 3, 4];

var removed = _.remove(a, function (n) { return n % 2 == 0; });
var kept    = _.filter(b, function (n) { return n % 2 == 0; });

// removed → [2, 4]   a → [1, 3]   (mutated)
// kept    → [2, 4]   b → [1, 2, 3, 4] (unchanged)
Try It Yourself

How It Works

  1. remove. Mutates a; return is what left.
  2. filter. Leaves b alone; return is what matched.
  3. Same numbers. Both return [2, 4] here — different side effects.
  4. Rule. Need immutability → filter / reject. Need in-place → remove.

Browser & Runtime Support

_.remove is a Lodash 4.x Array helper. It runs anywhere Lodash runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install lodash.

✓ Stable · Lodash 4.x

_.remove()

Available in [email protected] full builds and the lodash/remove modular import. Closest native pattern is a reverse-loop with splice, or filter for a non-mutating keep-list.

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
_.remove Lodash 4.x+

Bottom line: Safe for production once Lodash is loaded. Prefer import remove from "lodash/remove" for smaller bundles. Remember: mutates the source and returns the removed values.

Frequently Asked Questions

_.remove(array, predicate) deletes every element for which predicate returns truthy. It mutates array and returns a new array of the removed values (in order).
Yes. Unlike _.filter / _.reject, the source array loses matching items. Capture the return value for the removed chunk — it is not the source array.
predicate(value, index, array) — the same trio used by filter-style iteratees. Shorthands like matches objects and property names also work.
filter leaves the source untouched and returns kept elements. remove mutates the source and returns the removed elements instead.
pull removes by explicit values (SameValueZero). remove removes whenever your predicate (or iteratee shorthand) says so.
Use import remove from "lodash/remove" or require("lodash/remove") for tree-shaking friendly bundles. Full build: import _ from "lodash" then _.remove.

Next: _.reverse()

Reverse an array in place and reuse the same reference.

_.reverse() 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