Skip to content

Instantly share code, notes, and snippets.

@favrik
Created December 5, 2011 00:49
Show Gist options
  • Save favrik/1431827 to your computer and use it in GitHub Desktop.
Save favrik/1431827 to your computer and use it in GitHub Desktop.
Why .apply is awesome
// Set container height to highest list
var heights = $('.articleSection').map(function() {
return $(this).innerHeight();
}).get();
console.log(heights);
var max = Math.max.apply(Math, heights);
//$('.articlesWidget .wrapper').height(max);
@favrik
Copy link
Author

favrik commented Dec 5, 2011

Math.max only accepts parameters as a comma separated list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment