using .entries and .max together in javascript code example
Example 1: javascript restrict number to range
// Restricts number from 20 to 1
// if number > 20 returns 20
// if number < 1 returns 1
// else returns number
var number = Math.min(Math.max(parseInt(number), 1), 20);
Example 2: how to return the max and min of an array in javascript
function minMax(arr) {
return [Math.min(...arr), Math.max(...arr)];
}