Function intersects

Given two arrays, returns true if any elements intersect

const oceanFish = ['tuna', 'tarpon']
const lakeFish = ['bass', 'trout']

intersects(oceanFish, lakeFish) // => false

const brackishFish = ['tarpon', 'snook']

intersects(oceanFish, brackishFish) // => true
  • Type Parameters

    • T
    • K extends string | number | symbol

    Parameters

    • listA: readonly T[]
    • listB: readonly T[]
    • Optionalidentity: ((t: T) => K)
        • (t): K
        • Parameters

          Returns K

    Returns boolean