Use of const and reduced duplication
Use of const and reduced duplication

Changed code to use const instead of let, as these variables should be read-only references to these values.
I've also removed the only duplicated variable definition; I've named it targetIndex as I couldn't think of anything better (naming things is hard!)

This is a great repo, perfect for implementing drag and drop state changes ;)
granteagon/move