![]() |
VOOZH | about |
Underscore.js_.invert() function is used to return the copy of an object where the object key is converted into value and object value is converted into the key. It means the [key, value] of the object is reversed.
_.invert( object );It returns the [key, value] of an object in reverse [value, key] order.
Example 1: The below code will explain the implementation of the _.invert() function in underscore.js.
Output:
👁 ImageExample 2: The below code example is another implementation of the _.invert() function.