Leetcode Check Palindrome Using Javascript Innerhtml Not Updating