If I make a selection in a html page and I do :
var a = document.getSelection()
I get an object with four properties :
According to MDN
Selection.anchorNode - Returns the Node in which the selection begins.
Selection.focusNode - Returns the Node in which the selection ends.
because there were debates on naming, baseNode is alias for anchorNode, extentNode for focusNode
The following is beyond the scope of this question, but i'll post this anyway, as i found selection to be a tricky part in some scenarios.
Take a look at this example:
ab1234567890 !
Let's say we've made selection "1234567890". I've made a picture to explain where anchor and focus nodes and offsets are.