pols-utils - v5.3.11
    Preparing search index...

    Function distinct

    • Gets a new array with only distinct elements. Only primitive values (string, number, boolean, etc) are compared.

      Type Parameters

      • T

        The type of elements in the array.

      Parameters

      • array: T[]

        The target array.

      Returns T[]

      A new array containing only unique elements.

      const mynumbers = [0, 1, 2, 2, 2, 5, 6, 7, 7, 7]
      console.log(PUtilsArray.distinct(mynumbers))