Leetcode Check Palindrome Using Javascript