isCollapsed

The Selection.isCollapsed read-only property returns a boolean value which indicates whether or not there is currently any text selected.

MDN Reference