javascript minimum number in array
const min = arr => Math.min(...arr);
javascript minimum number in array
const min = arr => Math.min(...arr);
javascript get minimum value in array
// Getting min value
var arr = [5,1,9,5,7];
var min = Math.min(...arr);
console.log(min); // 1
// Getting max value
var arr = [5,1,9,5,7];
var min = Math.max(...arr);
console.log(min); // 9
find min in array java
private static int findMin(int[] array) {
int min = array[0];
for(int i=1;i<array.length;i++) {
if(min > array[i]) {
min = array[i];
}
}
return min;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us