I am calling reduce two times to get the min and max but insted is there a way that i can call reduce only onetime and get the same result - Must do this by using a single call to reduce. - For example, minMax([4, 1, 2, 7, 6]) returns [1, 7]
function minMax(items)
{
return [items.reduce((prev, curr)=> Math.min(prev, curr)),
items.reduce((prev, curr)=> Math.max(prev, curr))]
}