Open In App

Underscore.js Utility Complete Reference

Improve
Improve
Like Article
Like
Save
Share
Report

Underscore.js is a lightweight JavaScript library and not a complete framework that was written by Jeremy Ashkenas that provides utility functions for a variety of use cases in our day-to-day common programming tasks.

The complete reference for underscore utility is provided below:

Function

Description

_.noConflict() It creates a reference of the global underscore object “_” to another variable.
_.identity() It returns the exact same replica of the value given to it as the argument.
_.constant() It create a function that returns the parameter given to it.
_.noop() It is used to return “undefined” irrespective of the arguments passed to it.
_.times() It is used to call the function a particular number of times.
_.random() It returns a random integer which is in the range provided to the function.
_.mixin() It is used to add extra functionality.
_.iteratee() It generates a callback that can be applied to every element in a collection.
_.uniqueId() It generates a globally unique id for the client-side models.
_.escape() It is used to escape a special character string from inserting into HTML.
_.unescape() It is used to unescape a special character.
_.result() It gives value of a property of an object.
_.now() It returns the timestamp of the current time.
_.template() It compile JavaScript templates into functions that can be evaluated for rendering.

Last Updated : 02 Aug, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads