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

7 lines
222 B
JavaScript

const palindromes = function (string) {
const processedString = string.toLowerCase().replace(/[^a-z0-9]/g, "");
return processedString.split("").reverse().join("") == processedString;
};
module.exports = palindromes;