## Your search found these items:

Your search did not match any articles.

A `Range`

represents a contiguous, linear region of an element, specified by a start and end index. Most often it is used to indicate sections of a text stream.

The `Range`

class is not subclassable.

Creates a new `Range`

with a provided `start`

and `end`

index. Raises an `Error`

if the end index precedes the start index.

The start index of the range, as a `Number`

.

This property is readonly.

The end index of the range, as a `Number`

.

This property is readonly.

The length of the range, as a `Number`

. This is equivalent to subtracting `start`

from `end`

.

This property is readonly.

A `Boolean`

indicating whether the range is empty (its start and end indices are the same).

This property is readonly.

Returns `true`

if the receiver is equal to another provided range, `false`

otherwise.

Returns a `Number`

indicating how a provided range compares to the receiver in sort order. The return value will be `-1`

if the receiver’s start index precedes the other’s, or if the same, if its length is shorter. The return value will be `1`

if the opposite is true. The return value will be `0`

if the ranges are equal.

Returns `true`

if the receiver fully contains another provided range, `false`

otherwise.

Returns `true`

if the receiver contains a provided index (`Number`

), `false`

otherwise.

Returns a new `Range`

representing a union of the receiver and a provided range.

Returns a new `Range`

representing an intersection of the receiver and a provided range. If the two ranges to not intersect, the returned range will have zero start and end indices.

Returns `true`

if the receiver intersects a provided range (shares at least one index), `false`

otherwise.