javascript

Get the smallest integer value in an array using the JavaScript Math object

Using JavaScript's built-in Math object, you can easily retrieve the min and max integer values in an array.

const arr = [1, 7, 2, 10, 24, 3];
const min = Math.min.apply(Math, arr); // 1
const max = Math.max.apply(Math, arr); // 24

more JavaScript posts