JavaScript: Find the Smallest and Biggest Numbers

Create a function that takes an array of numbers and return both the minimum and maximum numbers, in that order.
minMax([1, 2, 3, 4, 5, 6, 7]) 
[1, 7]
function minMax(arr) {
let arr1 = [];
}
function minMax(arr) {
let arr1 = [];
arr1.push(Math.min(...arr));
arr1.push(Math.max(...arr));
return arr1
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store