revision:
The getSelection() method of the Document interface returns a Selection object representing the range of text selected by the user, or the current position of the caret.
getSelection()
Parameters: none
let selection = document.getSelection();
let selRange = selection.getRangeAt(0);
// do stuff with the range
console.log(selection); // Selection object