odin-default-js-exercises/palindromes/palindromes.js

12 lines
246 B
JavaScript
Raw Normal View History

2017-12-15 17:15:57 +00:00
const palindromes = function(string) {
processedString = string.toLowerCase().replace(/[^A-Za-z]/g, "");
return (
processedString
.split("")
.reverse()
.join("") == processedString
);
};
2017-08-25 19:07:28 +00:00
2017-12-15 17:15:57 +00:00
module.exports = palindromes;