@nevware21/ts-utils
    Preparing search index...

    Function arrDifference

    • The arrDifference() method returns a new array containing elements from the first array that do not exist in any of the other provided arrays. Uses strict equality (===) for comparison.

      Type Parameters

      • T

        Identifies the base type of array elements

      Parameters

      • theArray: ArrayLike<T>

        The source array to compare from

      • ...excludeArrays: ArrayLike<T>[]

        One or more arrays whose values should be excluded

      Returns T[]

      A new array containing elements only in the source array

      0.14.0

      arrDifference([1, 2, 3, 4], [2, 4]);           // [1, 3]
      arrDifference([1, 2, 3], [2], [3]); // [1]
      arrDifference(["a", "b", "c"], ["b"]); // ["a", "c"]
      arrDifference([1, 2, 3], []); // [1, 2, 3]
      arrDifference([], [1, 2]); // []

      // Array-like objects
      arrDifference({ length: 3, 0: 1, 1: 2, 2: 3 }, [2]); // [1, 3]