Insertion Sort Algorithm In Javascript