Lodash _.reverse() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Array

Definition

Reverses array so the first element becomes last, the second becomes second-to-last, and so on. Returns the same array reference. Part of Lodash 4.x Array.

Warning: This method mutates array and is based on Array.prototype.reverse. Clone first when another reference still needs the original order.

Syntax

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

Lodash
_.reverse(array)
CallWhat it does
_.reverse(array)Primary signature.
_.reverse(array)Call with an array argument.

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

Library declarations
Lodash
_.reverse(array)

Parameters

ParameterDescription
arrayRequired. Array to mutate

Return Value

Return ValueDescription
*Same array reference

Lodash Examples

Example 1 — Official: Reverse Numbers

Flip [1, 2, 3] so the ends swap.

Lodash
_.reverse([1, 2, 3]);
// → [3, 2, 1]
Try It Yourself

How It Works

  1. Ends swap. 1 and 3 trade places.
  2. Middle stays. 2 is already centered.
  3. Result. Order becomes [3, 2, 1].
  4. Mutates. The array you passed in is changed.

Example 2 — Reverse String Elements

Works the same for any element type.

Lodash
var letters = ['a', 'b', 'c', 'd'];
_.reverse(letters);
// → ['d', 'c', 'b', 'a']
Try It Yourself

How It Works

  1. Four items. Pair a↔d and b↔c.
  2. In place. letters itself is reversed.
  3. Types. Strings, numbers, objects — order flips the same way.
  4. Odd length. A middle element would stay put.

Example 3 — Same Reference Returned

The return value is the mutated array — useful for chaining.

Lodash
var array = [1, 2, 3];
var result = _.reverse(array);

console.log(result === array);
// → true

console.log(array);
// → [3, 2, 1]
Try It Yourself

How It Works

  1. Call. _.reverse(array) flips slots in place.
  2. Identity. result === array is true.
  3. Observers. Any other variable pointing at array sees the new order.
  4. Chain. You can keep calling Lodash methods on the same ref.

Example 4 — Reverse a Copy (Keep Original)

Slice first when the old order must stay intact.

Lodash
var original = [1, 2, 3, 4];
var flipped = _.reverse(original.slice());

// original → [1, 2, 3, 4]
// flipped  → [4, 3, 2, 1]
Try It Yourself

How It Works

  1. slice(). Builds a shallow copy.
  2. reverse copy. Only the copy is mutated.
  3. original safe. Still [1, 2, 3, 4].
  4. Pattern. Same idea as [...arr].reverse().

Example 5 — Lodash vs Native reverse

For arrays, both mutate and return the same reference.

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

_.reverse(a);
b.reverse();

// a → [3, 2, 1]
// b → [3, 2, 1]
Try It Yourself

How It Works

  1. Same idea. Lodash is based on Array#reverse.
  2. Both mutate. a and b flip in place.
  3. Why Lodash? Modular import and consistent chaining with other helpers.
  4. Pick. Either is fine for plain arrays — know that both mutate.

Browser & Runtime Support

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

✓ Stable · Lodash 4.x

_.reverse()

Available in [email protected] full builds and the lodash/reverse modular import. Native Array.prototype.reverse is universal; Lodash adds consistent chaining and tree-shakeable imports.

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

Bottom line: Safe for production once Lodash is loaded. Prefer import reverse from "lodash/reverse" for smaller bundles. Remember: this helper mutates — clone first when immutability matters.

Frequently Asked Questions

_.reverse(array) reverses the order of elements in place so the first becomes last. It returns the same array reference.
Yes. Official docs note it mutates array and is based on Array#reverse. Clone first if another reference still needs the old order.
Behavior matches Array.prototype.reverse for arrays. Lodash wraps it for consistent chaining and modular imports (lodash/reverse).
Copy first: _.reverse(array.slice()) or [...array].reverse(), or build a new list with a reverse loop / toReversed() where available.
The same collection reference after reversing — handy for chaining without a separate assignment.
Use import reverse from "lodash/reverse" or require("lodash/reverse") for tree-shaking friendly bundles. Full build: import _ from "lodash" then _.reverse.

Next: _.slice()

Copy a portion of an array into a new array without mutating.

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