Underscore.js _.invert() Function
The _.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 reverse.
_.invert( object )
Parameters: This function accepts single parameter as mentioned above and described below:
- object: It contains the object element that holds the elements of key and value pair.
Return Value: It returns the [key, value] of an object in reverse [value, key] order.