odin-js-fundamentals-part-5/09_palindromes/solution/palindromes-solution.js

7 lines
222 B
JavaScript
Raw Permalink Normal View History

2024-01-11 08:52:05 +00:00
const palindromes = function (string) {
const processedString = string.toLowerCase().replace(/[^a-z0-9]/g, "");
return processedString.split("").reverse().join("") == processedString;
};
module.exports = palindromes;