Find the smallest number in an array JavaScript

Smallest number in JavaScript can be find in different ways we can use Math.min() in easy way.

We can find the smallest number from given list.

We use Math.min() function to find the smallest number.

min is a predefined number that is available in Math class.

Math.min() takes set of arguments or array to find the minimum value



Here we are passing number of elements.

var numbers = [55,43,67,48,32,77,5,51,66,34,65,87,98];
const min = Math.min(…numbers);

Here we are passing array in min().

If no argument is passes iin Math.min() then on printing this it will print Infinity.

This above example will print the Smallest number in JavaScript.

Read More

  1. Call Javascript function from HTML
  2. Javascript jquery checkbox checked, unchecked, ischecked