1const arr = [14, 58, 20, 77, 66, 82, 42, 67, 42, 4]
2const min = Math.min(...arr)
3console.log(min)
1//Not using Math.min:
2const min = function(numbers) {
3 let smallestNum = numbers[0];
4for(let i = 1; i < numbers.length; i++) {
5 if(numbers[i] < smallestNum) {
6 smallestNum = numbers[i];
7 }
8 }
9return smallestNum;
10};
1var test=[1, 2, 4, 77, 80];
2console.log("Smallest number in test: "+Math.floor(Math.min(test)));