Function less

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

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

> less([1, 2, 3, 4], 3, true)
[true, true, true, false]
  • 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 less than or equal to (true), or strictly less than (false).

    Returns boolean[]

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