Answers for "how to find the smallest number in an array"

10

javascript find smallest number in an array

const arr = [14, 58, 20, 77, 66, 82, 42, 67, 42, 4]
const min = Math.min(...arr)
console.log(min)
Posted by: Guest on February-16-2020
2

find smallest number in array js

//Not using Math.min:
const min = function(numbers) {
  let smallestNum = numbers[0];
for(let i = 1; i < numbers.length; i++) {
    if(numbers[i] < smallestNum) {
      smallestNum = numbers[i];   
    }
  }
return smallestNum;
};
Posted by: Guest on January-05-2021
1

get smallest value in array js

var test=[1, 2, 4, 77, 80];
console.log("Smallest number in test: "+Math.floor(Math.min(test)));
Posted by: Guest on April-24-2021
1

how to find smallest number in array js

Array.min = function( array ){
    return Math.min.apply( Math, array );
};
Posted by: Guest on November-25-2020
0

java find biggest number in array

for (int counter = 1; counter < decMax.length; counter++)
{
     if (decMax[counter] > max)
     {
      max = decMax[counter];
     }
}

System.out.println("The highest maximum for the December is: " + max);
Posted by: Guest on February-15-2020
0

js get smallest value of array

Array.min = function( array ){
    return Math.min.apply( Math, array );
};
var minimum = Array.min(array);
Posted by: Guest on February-25-2021

Code answers related to "how to find the smallest number in an array"

Python Answers by Framework

Browse Popular Code Answers by Language