• Returns the count of elements in the given array which match the given filter

    Type Parameters

    • E

    Parameters

    • Optionalarray: null | E[] | readonly E[]

      the array to inspect

    • Optionalpredicate: ((value: E, index: number) => boolean)

      the function to filter the given array

        • (value, index): boolean
        • Parameters

          • value: E
          • index: number

          Returns boolean

    Returns number

    the count of elements in the given array which match the given filter

    count(['foo', 'bar', 'foobar'], value => value.includes('foo'));    // 2