Leetcode Check Palindrome Javascript