const palindrome = (str: string) => {
const s = str.toLowerCase().replace(/[\W_]/g, '');
return s === [...s].reverse().join('');
};
Check palindrome
Checks if the given string is a palindrome.
0 Comments
Add Comment
Log in to add a comment
const palindrome = (str: string) => {
const s = str.toLowerCase().replace(/[\W_]/g, '');
return s === [...s].reverse().join('');
};
Check palindrome
Checks if the given string is a palindrome.
Log in to add a comment