matician - v2.0.0
    Preparing search index...

    Function mode

    • Returns the mode(s) — the most frequently occurring number(s) — in an array.

      Parameters

      • values: number[]

        An array of numbers.

      Returns number[]

      An array of the mode(s). Multiple values are returned in case of a tie.

      Will throw an error if the input array is empty.

      mode([1, 2, 2, 3]);        // returns [2]
      mode([1, 1, 2, 2, 3]); // returns [1, 2]
      mode([5, 5, 5]); // returns [5]