getRangeAt

fun getRangeAt(index: Int): Range(source)

The getRangeAt() method of the Selection interface returns a range object representing a currently selected range.

MDN Reference