The _.accessor() method returns a function that will attempt to look up a given field in the given object.
funct = _.accessor( field_name );
- field_name: This method takes the field to be searched in the given object.
Return Value: This method returns a function that will attempt to look up a given field in the given object.
underscore.js contrib library can be installed using npm install underscore-contrib –save.
Example 2: If this function does not find any field then it will return undefined.