Python Recursive Function For Palindrome Program In Javascript