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};
1Array.min = function( array ){
2 return Math.min.apply( Math, array );
3};
4
1var arr = ['cats', 'giants', 'daughters', 'ice'];
2var min = Math.min(...arr.map(({ length }) => length));
3console.log(min);