Palindrome String Leetcode Problems Javascript