TS-Scribe - v0.6.2
    Preparing search index...

    Function arrayDifference

    • Computes the difference between multiple arrays.

      This function returns a new array containing elements that exist in the first array but do not appear in any of the subsequent arrays.


      Example:

      const arr1 = [1, 2, 3, 4];
      const arr2 = [3, 4, 5];
      const arr3 = [4, 6];
      const result = arrayDifference(arr1, arr2, arr3);
      console.log(result); // [1, 2]

      Type Parameters

      • T

      Parameters

      • ...arrays: T[][]

        One or more arrays to compare.

      Returns T[]

      A new array containing elements from the first array that are not in any of the other arrays.

      const arr1 = [1, 2, 3];
      const arr2 = [2, 3, 4];
      const result = arrayDifference(arr1, arr2);
      console.log(result); // [1]