Underscore.js Collections: Max

HTML

<script src="http://documentcloud.github.com/underscore/underscore-min.js"></script>
<a target="parent" href="http://underscorejs.org/#max">Learn More</a>

JavaScript

var movies = [{title:'Pulp Fiction',star:'Many',year:'1995'},{title:'Mean Girls',star:'Lindsey',year:'2000'}];

//Finds the highest number in a set of values, based off a given key
var testMax = _.max(movies, function(movie){ return movie.year;});

console.log(testMax);
//Object {title: "Mean Girls", star: "Lindsey", year: "2000"}