var arr = [3,1,2,6,7,8]; var maxNum = Math.max.apply(Math,arr); //8 var minNum = Math.min.apply(Math,arr); //1