Math.min.apply(0, x) - why?

Posted by Trevor Burnham on Stack Overflow See other posts from Stack Overflow or by Trevor Burnham
Published on 2010-05-19T22:53:28Z Indexed on 2010/05/19 23:00 UTC
Read the original article Hit count: 222

Filed under:

I was just digging through some JavaScript code (Raphaël.js) and came across the following line (translated slightly):

Math.min.apply(0, x)

where x is an array. Why on earth would you do this? The behavior seems to be "take the min from the array x."

© Stack Overflow or respective owner

Related posts about JavaScript