odin-default-js-exercises/09_palindromes/solution/palindromes-solution.js

7 lines
219 B
JavaScript
Raw Normal View History

2022-02-20 19:07:44 +00:00
const palindromes = function (string) {
2023-01-21 17:53:41 +00:00
const processedString = string.toLowerCase().replace(/[^a-z]/g, "");
return processedString.split("").reverse().join("") == processedString;
2022-02-20 19:07:44 +00:00
};
module.exports = palindromes;