Leetcode Problem Reverse Integer Javascript