Leetcode Check Palindrome Using Javascript Variables