Problem Description
A palindrome is a word, phrase, or sequence that reads the same backward as forward. For example, "racecar" or "madam".
Write a function isPalindrome(str) that takes a string and returns true if the string is a palindrome and false if it is not.
For this challenge, we should ignore punctuation, spaces, and casing. So, "A man, a plan, a canal: Panama" should return true.
Here are some test cases:
isPalindrome("racecar")should returntrueisPalindrome("hello")should returnfalseisPalindrome("A man, a plan, a canal: Panama")should returntrue
You already know how to reverse a string, which is half the battle! The other half is cleaning up the input string first.
💡 The 'Syntax Nudge'
To solve this, you'll need to "sanitize" the input string before you check it. I suggest you research these two tools:
String.prototype.toLowerCase(): How can you make sure "T" is treated the same as "t"?String.prototype.replace(): This method is incredibly powerful. Specifically, look up how to use it with a bit of RegEx (Regular Expressions) to remove characters you don't want. A good RegEx to search for would be one that finds all non-alphanumeric characters.