const min = arr => Math.min(...arr);
// Assuming the array is all integers,
// Math.min works as long as you use the spread operator(...).
let arrayOfIntegers = [9, 4, 5, 6, 3];
let min = Math.min(...arrayOfIntegers);
// => 3
function minMax(arr) {
return [Math.min(...arr), Math.max(...arr)];
}
var min = Math.min.apply(null, arr),
max = Math.max.apply(null, arr);
public class ArrayMin {
public static void main(String[] args) {
double[] numbers = new double[4];
numbers[0] = 1.7;
numbers[1] = 1.9;
numbers[2] = 5.7;
numbers[3] = 6;
double min = numbers[0];
for (int i = 0; i < numbers.length; i++) {
if(numbers[i] < min) {
min = numbers[i];
}
System.out.println(min);
}
}
}