Excellent explanation! Super clear and easy to understand…thank you. Actually, I now remember reading something about this before, but completely let it escape my memory.
Any idea how I can make the speed variable work outside the fn.extend? It needs to be accessed by other functions that are absent from the sample.
Here is a working fiddle with the speed variable exclusive to the first function: http://jsfiddle.net/nLgLP/