2024-01-11 09:08:59 +00:00
|
|
|
const palindromes = function (string) {
|
2024-01-11 09:13:14 +00:00
|
|
|
const reversed = string.split("").reverse().join("").replace(/[\.,?! ]/g, "");
|
|
|
|
string = string.replace(/[\.,?! ]/g, "");
|
|
|
|
if (reversed.toLowerCase() === string.toLowerCase()) {
|
2024-01-11 09:08:59 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2024-01-11 08:52:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Do not edit below this line
|
|
|
|
module.exports = palindromes;
|