odin-javascript-exercises/palindromes/palindromes.js

12 lines
246 B
JavaScript
Raw Normal View History

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