# maxN

Use
import { maxN } from 'util-snippets'

/**
 * Example:maxN([1, 2, 3]); // [3]
 * Example:maxN([1, 2, 3], 2); // [3,2]
 */

maxN(array,number)
Code
const maxN = (arr: number[], n = 1): number[] => [...arr].sort((a, b) => b - a).slice(0, n);