Lodash _.mapValues() Method Last Updated : 31 Oct, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report Lodash _.mapValues() method is used to create a new mapped object with the same keys as the given object and the values are generated using the given iteratee function. Syntax:_.mapValues(object, iteratee);Parameters: object: This parameter holds the object to iterate over.iteratee: This parameter holds the function that is invoked per iteration on the object. It is an optional value.Return Value: This method returns the new mapped object. Example 1: In this example, we are creating a new object having the same password as the old one by the use of the lodash _.mapValues() method. JavaScript // Requiring the lodash library const _ = require("lodash"); let users = { 'Geeksforgeeks': { 'username': 'gfg_id', 'password': 'gfg@123' }, 'W3school': { 'username': 'w3school_id', 'password': 'w@123' } }; // Using the _.mapValues() method console.log( _.mapValues(users, function (o) { return o.password; }) ); Output: {Geeksforgeeks: "gfg@123", W3school: "w@123"} Example 2: In this example, we are creating a new object having the same username as the old one by the use of the lodash _.mapValues() method. JavaScript // Requiring the lodash library const _ = require("lodash"); let users = { 'Geeksforgeeks': { 'username': 'gfg_id', 'password': 'gfg@123' }, 'W3school': { 'username': 'w3school_id', 'password': 'w@123' } }; // Using the _.mapValues() method console.log(_.mapValues(users, 'username')); Output: { Geeksforgeeks: 'gfg_id', W3school: 'w3school_id' } Comment More infoAdvertise with us Next Article Lodash _.assignIn() Method S sanjoy_62 Follow Improve Article Tags : JavaScript Web Technologies JavaScript-Lodash Similar Reads Lodash _.assign() Method Lodash _.assign() method is used to assign the enumerable string keyed properties of the given source objects to the destination objects. The source objects are applied from left to right and any subsequent sources overwrite the property assignments of the previous sources. Syntax:_.assign( dest_obj 1 min read Lodash _.assignIn() Method Lodash _.assignIn() method is like the _.assign() method except that it iterates over its own and inherited source properties. Subsequent source objects overwrite property assignments of previous sources. This method mutates the object. Syntax:_.assignIn( dest_object, [src_obj]);Parameters: dest_obj 1 min read Lodash _.assignInWith() Method Lodash _.assignInWith() method of Object in lodash is similar to _.assignIn the method and the only difference is that it accepts customizer which is called in order to generate assigned value. Moreover, if the customizer used here returns undefined then the assignment is dealt with by the method in 2 min read Lodash _.assignWith() Method Lodash _.assignWith() method of Object in lodash is similar to the _.assign method and the only difference is that it accepts customizer which is called in order to generate assigned value. Moreover, if the customizer used here returns undefined then the assignment is dealt with by the method instea 2 min read Lodash _.at() Method Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, collection, strings, lang, function, objects, numbers etc. The _.at() method creates an array of values corresponding to paths of object. Syntax: _.at(object, [paths]) Parameters: This method 2 min read Lodash _.create() Method Lodash _.create() method creates an object that inherits from the prototype object. If a properties object is given, its own enumerable string keyed properties are assigned to the created object. Syntax:_.create( proto_obj, property_object);Parameters: proto_obj: This is the object to inherit from.p 1 min read Lodash _.defaults() Method Lodash _.defaults() method assigns properties of source objects to the destination object for all destination properties that resolve to undefined. Source objects are applied from left to right. Once a property is set, additional values of the same property are ignored. This method mutates the objec 2 min read Lodash _.defaultsDeep() Method Lodash _.defaultsDeep() method recursively assigns default properties. It is almost the same as the _.defaults() function. This method mutates the object. Syntax:_.defaultsDeep(object, [sources]);Parameters:object: This parameter holds the destination object.sources: This parameter holds the source 1 min read Lodash _.entries() Method The _.entries() method is used to create an array of keyed-value pairs for the specified object. If object is a map or set, its entries are returned. Syntax: _.entries(object) Parameters: This method accepts single parameter as mentioned above and described below: object: This parameter holds the ob 1 min read Lodash _.entriesIn() Method The _.entriesIn() method is used to create an array of own and inherited enumerable string keyed-value pairs for the specified object. If object is a map or set, its entries are returned. Syntax: _.entriesIn(object) Parameters: This method accepts a parameter as mentioned above and described below: 1 min read Like