Saturday, January 17, 2026
HomeLanguagesJavascriptLodash _.dictionary() Method

Lodash _.dictionary() Method

The Lodash _.dictionary() method returns a function that will attempt to look up a field that it is given.

Syntax:

funct = _.dictionary( object );

Parameters: This method accepts single parameter as mentioned above and described below:

  • object: This method takes the object from which the field is to be searched.

Return Value: This method returns a function that will attempt to look up a field that is given.

Note: This will not work in normal JavaScript because it requires the lodash.js contrib library to be installed. Lodash.js contrib library can be installed using npm install lodash-contrib.

Example 1:

Javascript




// Defining underscore lodash variable 
var _ = require('lodash-contrib'); 
  
var ob = { gfg : "neveropen" } 
var gfgg = _.dictionary( ob ); 
    
console.log(gfgg("gfg"));


Output:

neveropen

Example 2:

Javascript




// Defining underscore lodash variable 
var _ = require('lodash-contrib'); 
  
var ob = { gfg : "neveropen" } 
var gfgg = _.dictionary( ob ); 
    
console.log(gfgg("geek"));


Output:

undefined
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
32474 POSTS0 COMMENTS
Milvus
118 POSTS0 COMMENTS
Nango Kala
6846 POSTS0 COMMENTS
Nicole Veronica
11977 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12063 POSTS0 COMMENTS
Shaida Kate Naidoo
6985 POSTS0 COMMENTS
Ted Musemwa
7219 POSTS0 COMMENTS
Thapelo Manthata
6933 POSTS0 COMMENTS
Umr Jansen
6911 POSTS0 COMMENTS