Write a function checkPalindrome(text) that checks if the string text is a palindrome, prints the answer with console.log and returns it as a boolean.
a to z, A to Z) and digits (0 to 9) count. Skip every other character: spaces, commas, question marks, underscores and so on.'A man, a plan, a canal: Panama' is a palindrome.'0P' is not a palindrome."<text>" is a palindrome or "<text>" is not a palindrome. Here <text> is the original text, unchanged, inside double quotes.true or false.A regular expression can remove the characters that do not count.
checkPalindrome('A man, a plan, a canal: Panama')Returns true
Prints "A man, a plan, a canal: Panama" is a palindrome
checkPalindrome('hello')Returns false
Prints "hello" is not a palindrome
Asked at ServiceNow · Source
checkPalindrome('A man, a plan, a canal: Panama')true"A man, a plan, a canal: Panama" is a palindromecheckPalindrome('hello')false"hello" is not a palindromeHidden tests run on Submit.