get highest number from array code example

Example 1: get largest number in array javascript

const array1 = [1, 3, 2];

Math.max(...array1);
// expected output: 3

Example 2: how to find max in array

int[] a = new int[] { 20, 30, 50, 4, 71, 100};
		int max = a[0];
		for(int i = 1; i < a.length;i++)
		{
			if(a[i] > max)
			{
				max = a[i];
			}
		}
		
		System.out.println("The Given Array Element is:");
		for(int i = 0; i < a.length;i++)
		{
			System.out.println(a[i]);
		}
		
		System.out.println("From The Array Element Largest Number is:" + max);

Example 3: find highest value in array javascript

const array = [10, 2, 33, 4, 5];

console.log(Math.max(...array)
)