Function includes

Checks if a value is included in a source array or string.

includes(1)([1, 2, 3]); // => true
includes(1)([2, 3]); // => false
includes({})({}); // => false, because they hold different references
  • Type Parameters

    • V

    Parameters

    • search: V
    • OptionalstartIndex: number

    Returns ((source: V extends string
        ? string | readonly unknown[]
        : readonly unknown[]) => boolean)

      • (source): boolean
      • Parameters

        • source: V extends string
              ? string | readonly unknown[]
              : readonly unknown[]

        Returns boolean