As readers might gather from the following...I am fairly new to D3....I am experimenting at the moment using .enter() and .exit().remove(). I am
Per request from my SO hero, let me try to address @markthekoala 's desire for a console experimentation that clearly demonstrates the effect of specifying a key function within the .data() operator.
http://bl.ocks.org/migurski/4601038
I actually consider this an even more pointed example than the excellent one I linked to in my comments above! NOTE: the long title of the block has a good explanation on what is happening under the hood, so read it carefully.
You can play with the block's code in this FIDDLE.
Honestly, I find it very hard to improve on the explanations in these two examples, and particularly on the experimentation so cleverly carried out on the second one.