Javascript Check Palindrome Leetcode