Skip to content

Instantly share code, notes, and snippets.

@sudowork
Last active December 11, 2015 22:18
Show Gist options
  • Save sudowork/4668114 to your computer and use it in GitHub Desktop.
Save sudowork/4668114 to your computer and use it in GitHub Desktop.
// From underscorejs.org documentation
var stooges = [
{
name : 'curly',
age : 25
},
{
name : 'moe',
age : 21
},
{
name : 'larry',
age : 23
}
];
var youngest = _.chain(stooges)
.sortBy(function(stooge){ return stooge.age; })
.map(function(stooge){ return stooge.name + ' is ' + stooge.age; })
.first()
.value();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment