Palindrome checker implemented in JavaScript