Test if a string is a palindrome
I suggest you whitelist allowable characters instead of blacklisting invalid characters. It's easier to list what's allowed than to chase all possible invalid characters.
Suggesting you move out the regex from the function to avoid recreating it on every call. The pattern is actually an object. Also, I'd suggest throwing an error instead of returning a message. Usually better to test.
The function checks if a string is a palindrome or not. Boolean is the correct return type. Errors should only be used when encountering something unexpected.
A lot, especially when you're blacklisting instead of whitelisting.
Small scale, yes. On larger apps, suggesting the use of a full test framework for more options.