codetrix - v1.5.0
    Preparing search index...

    Function difference

    • Returns a new array with elements from the first array that are not present in the second array.

      Type Parameters

      • T

        The type of array elements.

      Parameters

      • array: T[]

        The source array.

      • values: T[]

        The values to exclude.

      Returns T[]

      A new array excluding the specified values.

      difference([1, 2, 3, 4], [2, 4]); // [1, 3]