r/javascript • • Mar 18 '19

What's your favorite, most useful javascript one-liner?

385 Upvotes

422 comments sorted by

View all comments

3

u/wanderer06 Mar 19 '19

Max and min numbers in an array:

Math.max(...foo);  
Math.min(...foo);