Leetcode Check Palindrome In Javascript