has()

Checks whether the value is in the range of a specified `Range` object

Range.prototype.has()

The has() method checks whether the value is in the range of a specified Range object.

range.class.ts
public has(value: number): boolean {
  return (
    (this.minLessThan(value) && this.maxGreaterThan(value)) ||
    value === this.min ||
    value === this.max
  );
}

Parameters

value:number

The value of number type to test.

Return type

Returns

The return value is a boolean indicating whether the given value is in the range of a specified Range object.

Example usage

Last updated