rangeCount

The Selection.rangeCount read-only property returns the number of ranges in the selection.

MDN Reference