javascript get minimum of collection code example
Example 1: Obtain smallest value from array of objects in Javascript
myArray.sort(function (a, b) {
return a.Cost - b.Cost
})
var min = myArray[0],
max = myArray[myArray.length - 1]
Example 2: how to find max number in array javascript
const array1 = [1, 3, 2];
console.log(Math.max(...array1));