4 ms·
You can use .reduce((acc, curr) => curr > 0 && curr < acc ? curr : acc) and have the best of both worlds. In some cases, there are persuasive arguments to favo
by recursive 5y ago
You can use .reduce((acc, curr) => curr > 0 && curr < acc ? curr : acc) and have the best of both worlds.
In some cases, there are persuasive arguments to favor readability over performance, but I don't find this particular example very convincing.