![]() |
VOOZH | about |
Lodash _.toPairs() method is used to create an array of enumerable string key-value pairs for an object that can be consumed by the _.fromPairs() function. If the object is a map or set, its entries are returned.
_.toPairs(object);This method returns the array of key-value pairs.
Example 1: In this example, we are getting a pair of the given function by creating a prototype of it by the use of the lodash _.fill() method.
Output:
[["id", 2045], ["username", "fb_myself"], ["password", "fb1234"]]Example 2: In this example, we are getting a pair of the given object by the use of the lodash _.fill() method.
Output:
[['x', 1], ['y', 2]]