1var arr = [1, 2, 3];
2var max = arr.reduce(function(a, b) {
3 return Math.max(a, b);
4});
1//get min/max value of arrays
2function getArrayMax(array){
3 return Math.max.apply(null, array);
4}
5function getArrayMin(array){
6 return Math.min.apply(null, array);
7}
8var ages=[11, 54, 32, 92];
9var maxAge=getArrayMax(ages); //92
10var minAge=getArrayMin(ages); //11
1function getMaxOfArray(numArray) {
2 return Math.max.apply(null, numArray);
3}
1function maisBaratosQue(valor, precos) {
2 return precos.filter(p => p <= valor);
3}