UNPKG

@princedev/calculate

Version:

Fast, lightweight, and extinsible mathematical and statistical functions.

22 lines (21 loc) 520 B
/** * @name mode * @summary Returns the mode. * * @description Returns the highest occuring number/s in a given numbers. * * @example * // Normal usage * let result = mode(2, 1, 8, 3, 2, 7, 4, 2, 6, 8); * // => [2] * * // Using an array * let result = mode(...[2, 1, 8, 3, 2, 7, 4, 2, 6, 8]); * // => [2] * * @param {Array<number>} args given numbers. * @returns {Array<number>} the resulting mode. * * @function pure */ export default function mode(...args: number[]): number[];