The _.propertyOf() function in the Underscore library returns a function that can be used to extract a specific property from an object. Here's an example of how to use it:
index.tsx509 chars17 linesIn this example, we first load the Underscore library. We then define an array of car objects, each with a 'make', 'model', and 'year' property. We then use _.propertyOf() to create a function getYear that can be used to extract the 'year' property from any car object. Finally, we use getYear to get the year of the first car in the array and log it to the console.
gistlibby LogSnag