A RetroSearch Logo

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

Search Query:

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

Lodash _.zipObjectDeep() Method - GeeksforGeeks

Lodash _.zipObjectDeep() Method

Last Updated : 15 Jul, 2025

Lodash _.zipObjectDeep() method is similar to the _.zipObject() method except that it supports property paths and also, it accepts two arrays, one of property identifiers and one of corresponding values.

Syntax:
_.zipObjectDeep([props=[]], [values=[]]);
Parameters: Return Value:

Example 1: In this example, we are getting a new object by using the lodash _.zipObjectDeep() method.

javascript
// Requiring the lodash library 
const _ = require("lodash");

// Original array 

let obj1 = ['a.b[0].c', 'a.b[1].d'];

// Use of _.zipObjectDeep() method

let gfg = _.zipObjectDeep(obj1, [1, 2]);

// Printing the output 
console.log(gfg);

Output:

{ a: { b: [ [ object ], [object] ] } }

Example 2: In this example, we are getting a new object by using the lodash _.zipObjectDeep() method.

javascript
// Requiring the lodash library 
const _ = require("lodash");

// Original array 
let obj1 = ([40, 30, 90]);

// Use of _.zipObjectDeep() method
let gfg = _.zipObjectDeep(obj1, [1, 2, 3]);

// Printing the output 
console.log(gfg);

Output:

{ '30': 2, '40': 1, '90': 3 }

Example 3: In this example, we are getting a new object by using the lodash _.zipObjectDeep() method.

javascript
// Requiring the lodash library 
const _ = require("lodash");

// Original array 
let obj1 = (['a', 'g', 'h',
    'b', 'c', 'd', 'e', 'f']);

// Use of _.zipObjectDeep() 
// method
let gfg = _.zipObjectDeep(obj1,
    [1, 2, 3, 4, 5, 6, 7]);

// Printing the output 
console.log(gfg);

Output:

{ a: 1, g: 2, h: 3, b: 4, c: 5, d: 6, e: 7, f: undefined }

Note: This code will not work in normal JavaScript because it requires the library lodash to be installed.



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