Showing posts with label result. Show all posts
Showing posts with label result. Show all posts

Thursday, December 4, 2014

Lo-Dash: Using the result() function

The result() function is a handy way to look up object properties. If the property happens to be a function, result() will invoke it for us and return the result. Taken at face value, it doesn't seem like there's much to result(). On the contrary, it's a powerful tool. The basic usage looks like this:

var object = { name: 'Lo-Dash' };
_.result(object, 'name');
// → "Lo-Dash"