• Returns the difference between this and another array if comp is given, filters out all values from an array for which the comparator function does not return true

    Example

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

    Example

    diff([1, 1.2, 1.5, 3, 0], [1.9, 3, 0], (a, b) => Math.round(a) === Math.round(b)); // [1, 1.2]
    

    Type Parameters

    • T

    • P

    Parameters

    • array1: T[]
    • array2: P[]
    • Optional comp: ((a: T, b: P) => boolean)
        • (a: T, b: P): boolean
        • Parameters

          • a: T
          • b: P

          Returns boolean

    Returns T[]

Generated using TypeDoc