Function any

Returns true if the provided predicate function returns true for at least one element of a set, otherwise it returns false.

any([0, 1, 2, 0], x => x >= 2)
// true

1.0.9

  • Type Parameters

    • T = unknown

    Parameters

    • arr: T[]

      the target array

    • fn: AnyFunction

      the judgment method

    Returns boolean

    • the result of the judgment