Reverse Array Problem Leetcode Javascript Interview