Answers for "how to get the minimum of an array"

7

javascript minimum number in array

const min = arr => Math.min(...arr);
Posted by: Guest on July-03-2020
0

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
Posted by: Guest on January-13-2021
0

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;
	}
Posted by: Guest on May-10-2020

Code answers related to "how to get the minimum of an array"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language