A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/javascript/lodash-_-prototype-reverse-method/ below:

Lodash _.prototype.reverse() Method - GeeksforGeeks

Lodash _.prototype.reverse() Method

Last Updated : 15 Jul, 2025

Lodash _.prototype.reverse() method of Sequence in lodash is used to mutate the wrapped array. Moreover, it is the wrapper version of the _.reverse method of an array.

Syntax:
_.prototype.reverse();
Parameters:

This method doesn't accept any parameter.

Return Value:

This method returns the new lodash wrapper instance.

Example 1: In this example, we are getting the reverse of the given array by the use of the lodash _.prototype.reverse() method.

JavaScript
// Requiring lodash library
const _ = require('lodash');

// Creating an array of integers
let arr = [4, 5, 3];

// Calling _.prototype.reverse() method 
_(arr).reverse().value();

// Displays output
console.log(arr);

Output:

[ 3, 5, 4 ]

Example 2: In this example, we are getting the reverse of the given array by the use of the lodash _.prototype.reverse() method.

JavaScript
// Requiring lodash library
const _ = require('lodash');

// Creating an array of characters
let arr = ['a', 'b', 'c'];

// Calling _.prototype.reverse() method 
_(arr).reverse().value();

// Displays output
console.log(arr);

Output:

[ 'c', 'b', 'a' ]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4