Skip to content

Instantly share code, notes, and snippets.

@zy108830
Created March 29, 2016 08:03
Show Gist options
  • Save zy108830/ad77ae32f82571132678 to your computer and use it in GitHub Desktop.
Save zy108830/ad77ae32f82571132678 to your computer and use it in GitHub Desktop.
调用Math对象的min和max方法,求数组中的最小值和最大值
var arr=[1,2,3,4,5];
console.log(Math.min.apply(null,arr));//1
console.log(Math.max.apply(null,arr));//5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment