Insertion Sort Problem Leetcode Javascript