offset

The offset property of the CaretPosition interface returns an integer representing the offset of the selection in the caret position node.

MDN Reference