Underscore has a series of functions that specifically target objects of the type Function:
it has functions that target other functions. This subsection touches on some of the functional programming concepts that will be explored in detail in Chapter 4, Programming Paradigms with Underscore.js.
The first function is _.bind(function, object, *arguments)
that returns a new function wrapper for the original function
parameter. The wrapper function has the this
value set to the object
parameter and its arguments will be prefilled in order with the values from the *arguments
parameters. The returned function is also known as bound function and is an example of functional composition in action. Through functional composition, we can create new functions based on existing functions in scenarios where we cannot change the original function implementation (we don't own the code) or it is more convenient to do so. It is a core technique...