Answers for "largest and smallest number in an array 1-100 javascript"

8

get largest number in array javascript

const array1 = [1, 3, 2];

Math.max(...array1);
// expected output: 3
Posted by: Guest on August-07-2020
0

largest and smallest number in an array 1-100 javascript

let numArray = [95, 1, 75, 7, 12, 50, 3, 88]
numArray.slice().sort(function(a, b) {
  return a - b
})
console.log('smallest: ' + numArray[0] + ', largest: ' + numArray[numArray.length - 1])
Posted by: Guest on November-09-2020

Code answers related to "largest and smallest number in an array 1-100 javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language