Saturday, January 31, 2026
HomeLanguagesJavascriptLodash _.unzipWith() Method

Lodash _.unzipWith() Method

The _.unzipWith() method accepts iteratee to specify how regrouped values should be combined. The iteratee is invoked with the elements of each group.

Syntax:

_.unzipWith(array, [iteratee = _.identity])

Parameters: This method accepts two parameters as mentioned above and described below:

  • array: This parameter holds the array of grouped elements to process.
  • [iteratee = _.identity]: This parameter holds the function to combine regrouped values.

Return Value: This method returns the new array of regrouped elements.

Example 1: Here, const _ = require(‘lodash’) is used to import the lodash library into the file.

Javascript




// Requiring the lodash library  
const _ = require("lodash"); 
   
// Original array
var zipped_arr = _.zip([15, 7], [185, 20], [478, 123]);
   
// Use of _.unzipWith() method 
let gfg = _.unzipWith(zipped_arr, _.subtract);
         
// Printing the output  
console.log(gfg)


Output:

[8, 165, 355]

Example 2:  

Javascript




// Requiring the lodash library  
const _ = require("lodash"); 
   
// Original array
var zipped_arr = _.zip([4, 9], [185, 20], [478, 123]);
   
// Use of _.unzipWith() method 
let gfg = _.unzipWith(zipped_arr, _.add);
         
// Printing the output  
console.log(gfg)


Output:

[13, 205, 601]
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32478 POSTS0 COMMENTS
Milvus
122 POSTS0 COMMENTS
Nango Kala
6849 POSTS0 COMMENTS
Nicole Veronica
11978 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12066 POSTS0 COMMENTS
Shaida Kate Naidoo
6987 POSTS0 COMMENTS
Ted Musemwa
7222 POSTS0 COMMENTS
Thapelo Manthata
6934 POSTS0 COMMENTS
Umr Jansen
6917 POSTS0 COMMENTS