I have this code for a class where I\'m supposed to use the reduce() method to find the min and max values in an array. However, we are required to use only a single call to
You can use do like this. There can be any number of arguments.
function minValue(...args) { const min = args.reduce((acc, val) => { return acc < val ? acc : val; }); return min; } function maxValue(...args) { const max= args.reduce((acc, val) => { return acc > val ? acc : val; }); return max; }