3 lines
96 B
JavaScript
3 lines
96 B
JavaScript
const maxN = (arr, n = 1) => [...arr].sort((a, b) => b - a).slice(0, n);
|
|
module.exports = maxN;
|