Leetcode Arraylist Remove Function In Javascript Programming