• Parameters

    • array1: any[]

      an array of any primitive type

    • array2: any[]

      an array of any primitive type

    Returns any[]

    an array of values found inside both arrays.

    Description

    Return the intersection of two arrays. This assumes that the array values are primitives (this does not work if values are objects), and will stringify the values to compare, so 5 === "5" will match. If inside each arrays contains duplicates, the number of duplicates in the result will match the number shared between the two.