Get the Min Value of an Array with JavaScript

Web Dev
Sponsored links

In this article, I will introduce how to get the min value of an array with JavaScript.

The Math.min() method

If you specify multiple numbers as arguments, the Math.min() method returns the minimum value among them.

The syntax is below.


To get the min value of the array that stores the numerical value, it is as follows.

Sponsored links

Get the Min Value of an Array

Below is the sample code to get the minimum value of the array.

console.log(Math.min(2, 5, 3)); // 2

console.log(Math.min(-2, -5, -3)); // -5

const array=[3,6,2,9,7];
console.log(Math.min.apply(null,array)); // 2