selectionは「.selectAll()で対象となるDOM」と「.data()で渡したデータ」を比較すると理解しやすいです。
.selectAll()
.data()
.attr
.exit()
.remove()
.enter()