Lodash Array Methods

Beginner
7 min read
Updated: Nov 2026
64 method guides
Method index

About This Index

This page is the Lodash Arrays index for the tutorial track. Each row links to a full guide with syntax, examples, and FAQs.

Learn the Lodash overview on /lodash. Use this page when you need an array API such as _.chunk(), _.uniq(), or _.flatten().

Beginner path.

Start with _.chunk(), then _.compact(), _.uniq(), and _.flatten()—then browse set ops and mutating helpers as needed.

How to Call an Array Method

Import a method or use the _ object—most helpers return a new array:

Lodash
import _ from "lodash";
// or: import chunk from "lodash/chunk";

const nums = [1, 2, 3, 4, 5];

_.chunk(nums, 2);              // [[1, 2], [3, 4], [5]]
_.compact([0, 1, false, 2, "", 3]); // [1, 2, 3]
_.uniq([1, 2, 1, 4, 1, 3]);    // [1, 2, 4, 3]
_.flatten([1, [2, [3, [4]]]]); // [1, 2, [3, [4]]]
_.difference([2, 1], [2, 3]);  // [1]
_.zip(["a", "b"], [1, 2]);     // [["a", 1], ["b", 2]]

Lodash Array Methods Table

All array method guides in this Lodash tutorial series (64 tutorials).

Getting Started

3 methods

Chunk, clean falsy values, and concatenate arrays.

MethodDescriptionTutorial
_.chunk()Split an array into groups of a given size.Try it
_.compact()Remove falsy values (false, null, 0, "", undefined, NaN).Try it
_.concat()Create a new array concatenating array with additional values.Try it

Ends & Slices

14 methods

Read ends, drop or take portions, and slice ranges.

MethodDescriptionTutorial
_.head()First element of an array (alias: _.first).Try it
_.last()Last element of an array.Try it
_.nth()Element at index n (supports negative indices).Try it
_.initial()All but the last element.Try it
_.tail()All but the first element.Try it
_.drop()Drop n elements from the beginning.Try it
_.dropRight()Drop n elements from the end.Try it
_.dropWhile()Drop from the start while predicate returns truthy.Try it
_.dropRightWhile()Drop from the end while predicate returns truthy.Try it
_.take()Take n elements from the beginning.Try it
_.takeRight()Take n elements from the end.Try it
_.takeWhile()Take from the start while predicate is truthy.Try it
_.takeRightWhile()Take from the end while predicate is truthy.Try it
_.slice()Slice a portion of the array into a new array.Try it

Flatten & Pairs

5 methods

Flatten nests and convert pairs into objects.

MethodDescriptionTutorial
_.flatten()Flatten one level of nested arrays.Try it
_.flattenDeep()Recursively flatten until no nested arrays remain.Try it
_.flattenDepth()Flatten up to a given depth.Try it
_.fromPairs()Build an object from key-value pairs.Try it
_.join()Join elements into a string with a separator.Try it

Set Operations

16 methods

Difference, intersection, union, xor, uniq, and without.

MethodDescriptionTutorial
_.difference()Values from the first array not present in the others.Try it
_.differenceBy()Like difference, but values compared after invoking iteratee.Try it
_.differenceWith()Like difference, but uses a comparator for equality.Try it
_.intersection()Values common to all given arrays.Try it
_.intersectionBy()Intersection after mapping each element with iteratee.Try it
_.intersectionWith()Intersection using a comparator.Try it
_.union()Unique values from all arrays combined.Try it
_.unionBy()Union after mapping with iteratee.Try it
_.unionWith()Union using a comparator.Try it
_.uniq()Unique values preserving first-occurrence order.Try it
_.uniqBy()Unique by iteratee result.Try it
_.uniqWith()Unique using a comparator for equality.Try it
_.without()Exclude given values from the array (new array).Try it
_.xor()Symmetric difference of arrays.Try it
_.xorBy()Symmetric difference after iteratee.Try it
_.xorWith()Symmetric difference with comparator.Try it

Mutating Helpers

8 methods

In-place pull, remove, fill, and reverse — use carefully.

MethodDescriptionTutorial
_.fill()Fill elements with a value between start and end (mutates).Try it
_.pull()Remove all occurrences of given values in place.Try it
_.pullAll()Like pull, but accepts an array of values to remove.Try it
_.pullAllBy()Like pullAll, but values compared after iteratee.Try it
_.pullAllWith()Like pullAll, but uses a comparator.Try it
_.pullAt()Remove elements at indexes and return them.Try it
_.remove()Remove elements matching predicate; returns removed elements.Try it
_.reverse()Reverse the array in place.Try it

Index & Search

12 methods

Locate values by equality, predicate, or sorted binary search.

MethodDescriptionTutorial
_.indexOf()First index of value using SameValueZero.Try it
_.lastIndexOf()Last index of value, searching from the end.Try it
_.findIndex()Index of the first element matching predicate.Try it
_.findLastIndex()Index of the last element matching predicate.Try it
_.sortedIndex()Lowest index to insert a value and keep sort order.Try it
_.sortedIndexBy()Like sortedIndex, but compares iteratee(value).Try it
_.sortedIndexOf()Like indexOf for sorted arrays (binary search).Try it
_.sortedLastIndex()Highest index to insert a value and keep sort order.Try it
_.sortedLastIndexBy()Like sortedLastIndex with iteratee.Try it
_.sortedLastIndexOf()Like lastIndexOf for sorted arrays.Try it
_.sortedUniq()Unique values from a sorted array.Try it
_.sortedUniqBy()Unique by iteratee from a sorted array.Try it

Zip & Unzip

6 methods

Pair rows, build objects from key lists, and unzip tuples.

MethodDescriptionTutorial
_.zip()Group elements by index across arrays.Try it
_.zipWith()Zip arrays and combine tuples with iteratee.Try it
_.zipObject()Build an object from keys and values arrays.Try it
_.zipObjectDeep()Like zipObject, with support for nested paths.Try it
_.unzip()Inverse of zip — regroup tuples into arrays.Try it
_.unzipWith()Like unzip, then apply iteratee to regrouped values.Try it

Frequently Asked Questions

They are Lodash helpers for arrays: chunking and cleaning (_.chunk, _.compact), ends and slices (_.head, _.drop, _.take), set math (_.difference, _.union, _.uniq), flattening (_.flatten), mutating pulls (_.pull, _.remove), indexing, and zipping (_.zip).
Most return new arrays. Methods such as _.pull, _.pullAt, _.remove, _.reverse, and _.fill mutate the array in place—check each guide before use.
Prefer per-method imports for smaller bundles: import chunk from 'lodash/chunk' or import { chunk } from 'lodash-es'. You can also use const _ = require('lodash') and call _.chunk().
_.without returns a new array without the listed values. _.pull removes those values from the original array in place.
Start with _.chunk(), then _.compact(), _.uniq(), and _.flatten() from the table below.

Start with _.chunk()

Open the chunking guide—syntax, examples, and FAQs.

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

16 people found this page helpful