ts-utils
    Preparing search index...

    Function mode

    • Compute the mode of the given numbers.

      The most frequent number—that is, the number that occurs the highest number of times.

      Parameters

      • ...numbers: number[]

        The numbers used to compute the mode.

      Returns number[]

      The mode of the numbers.

      mode([1, 2, 2, 3]);
      // => [2]
      mode([1, 2, 5, 5, 2, 3, 3, 4]);
      // => [2, 3, 5]
      mode([1, 2, 3, 4, 5]);
      // => []
      mode([]);
      // => []