getRange()

Returns a range of numbers by the specified `step` from minimum to the given `value` of the specified `Range` object

Range.prototype.getRange()

The getRange() method returns a range of numbers by the specified step from minimum to the given value of the specified Range object.

range.class.ts
public getRange(value: number = this.max): Readonly<Array<number>> {
  const range = [];
  let current: number = this.min;
  while (current <= value) {
    current <= this.max && range.push(current), (current += this.#step);
  }
  return range;
}

Parameters

value:number= this.max

Optional maximum range value of number type of returned array by default it's the maximum range.

Return type

Returns

The return value is a range of numbers of a read-only Array from minimum to the given value.

Example usage

Last updated

Was this helpful?