Lodash _.pullAt() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Array

Definition

Removes elements at the given indexes from array and returns a new array of those removed values. Part of Lodash 4.x Array.

Warning: Unlike Array.prototype.at / Lodash _.at, this method mutates array. Capture the return value for the removed items — it is not the source array.

Syntax

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

Lodash
_.pullAt(array, [indexes])
CallWhat it does
_.pullAt(array, [indexes])Primary signature.
_.pullAt(array)Call with an array argument.

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

Library declarations
Lodash
_.pullAt(array, [indexes])

Parameters

ParameterDescription
arrayRequired. Array to mutate
indexesOptional. Index list and/or variadic indexes

Return Value

Return ValueDescription
*New array of removed values

Lodash Examples

Example 1 — Official: Array of Indexes

Remove two slots and keep both the survivors and the pulled values.

Lodash
var array = ['a', 'b', 'c', 'd'];
var pulled = _.pullAt(array, [1, 3]);

console.log(array);
// → ['a', 'c']

console.log(pulled);
// → ['b', 'd']
Try It Yourself

How It Works

  1. Indexes. Ask for positions 1 and 3.
  2. Collect. Those slots hold 'b' and 'd'.
  3. Mutate. Source shrinks to ['a', 'c'].
  4. Return. pulled is a new array — not the same as array.

Example 2 — Variadic Indexes

Pass indexes as separate arguments — same result as a list.

Lodash
var array = ['a', 'b', 'c', 'd'];
var pulled = _.pullAt(array, 1, 3);

// array  → ['a', 'c']
// pulled → ['b', 'd']
Try It Yourself

How It Works

  1. Flatten. Lodash treats 1, 3 like [1, 3].
  2. Same pull. Removes 'b' and 'd'.
  3. Either style. Use a list when indexes come from a variable.
  4. Pick one. Mixing styles is fine; flattening handles nesting.

Example 3 — Single Index

Pull one element — return is still an array of length 1.

Lodash
var array = ['a', 'b', 'c', 'd'];
var pulled = _.pullAt(array, 1);

// array  → ['a', 'c', 'd']
// pulled → ['b']
Try It Yourself

How It Works

  1. One slot. Index 1 holds 'b'.
  2. Shift. Later items move left — 'c' becomes index 1.
  3. Always an array. Even one removal returns ['b'], not a bare string.
  4. Tip. Use pulled[0] if you need the single value.

Example 4 — Pull Several Positions

Remove the ends and the middle of a longer list.

Lodash
var array = ['a', 'b', 'c', 'd', 'e'];
var pulled = _.pullAt(array, [0, 2, 4]);

// array  → ['b', 'd']
// pulled → ['a', 'c', 'e']
Try It Yourself

How It Works

  1. Three indexes. Positions refer to the original array.
  2. Collect. 'a', 'c', 'e' go into pulled.
  3. Survivors. 'b' and 'd' remain, in order.
  4. Safe. Lodash removes in an order that avoids index-shift bugs.

Example 5 — Return Value vs _.pull

pullAt returns removed items; pull returns the mutated array.

Lodash
var a = ['a', 'b', 'c', 'd'];
var b = ['a', 'b', 'c', 'd'];

var fromPullAt = _.pullAt(a, [1, 3]);
var fromPull   = _.pull(b, 'b', 'd');

// fromPullAt → ['b', 'd']   (removed)
// fromPull   → ['a', 'c']   (mutated source)
// a → ['a', 'c']   b → ['a', 'c']
Try It Yourself

How It Works

  1. Both mutate. Survivors end up the same here.
  2. pullAt. Return value is what left the array.
  3. pull. Return value is the shortened array itself.
  4. Rule. Need the removed chunk → pullAt. Need value-based strip → pull.

Browser & Runtime Support

_.pullAt 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

_.pullAt()

Available in [email protected] full builds and the lodash/pullAt modular import. Closest native pattern is Array.prototype.splice for contiguous ranges; pullAt shines when indexes are sparse or listed explicitly.

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

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

Frequently Asked Questions

_.pullAt(array, ...indexes) removes elements at the given indexes from array in place and returns a new array of those removed values.
Yes. The source array loses those slots. Unlike _.pull / _.pullAll, the return value is the removed items — not the mutated array itself.
splice uses (start, deleteCount) and can insert replacements. pullAt only removes by explicit indexes (array or variadic) and returns the pulled values.
_.at reads values at indexes without changing the array. pullAt removes those indexes and returns the removed values. Official docs note: unlike _.at, pullAt mutates.
Yes. Lodash flattens index arguments, so pullAt(arr, 1, 3) and pullAt(arr, [1, 3]) both work.
Use import pullAt from "lodash/pullAt" or require("lodash/pullAt") for tree-shaking friendly bundles. Full build: import _ from "lodash" then _.pullAt.

Next: _.remove()

Remove elements that match a predicate and get the removed values back.

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