Function greater

Returns an array indicating whether each element of the input array is greater than or equal to a given value (if eq is true) or strictly greater than the value (if eq is false).

> greater([1, 2, 3, 4], 3)
[false, false, false, true]

> greater([1, 2, 3, 4], 3, true)
[false, false, true, true]
  • Parameters

    • array: number[]

      The array of numbers to be compared.

    • value: number

      The value each element of the array is compared against.

    • Optionaleq: boolean = false

      A boolean indicating if the comparison should be greater than or equal to (true), or strictly greater than (false).

    Returns boolean[]

    An array of booleans where each boolean indicates if the corresponding element in array is greater than (or greater than or equal to) value.