Design Circular Deque Leetcode Javascript Question