implemented insertion sort in js