Using Math.min and Math.max for an array


/ Published in: JavaScript
Save to your folder(s)

Clever usage of apply allows you to use built-ins functions for some tasks that otherwise probably would have been written by looping over the array values. As an example here we are going to use Math.max/Math.min to find out the maximum/minimum value in an array.

URL: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/apply

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.