A JavaScript implementation of the insertion sort algorithm