isPalindrome
Checks if a string is a palindrome.
Note: A
palindrome
is a word, phrase, or sequence that reads the same backward as forward. This check ignores spaces, punctuation, and case.
Parameters
str
(string
): The string to check.
Returns
boolean
:true
if the string is a palindrome, otherwisefalse
.
Usage
ts
isPalindrome('madam'); // true
isPalindrome('racecar'); // true
isPalindrome('hello'); // false
isPalindrome('A man, a plan, a canal: Panama'); // true