Javascript: Insertion Sort