odin-javascript-exercises/09_palindromes/palindromes.js
2023-06-19 17:06:09 -07:00

9 lines
274 B
JavaScript

const palindromes = function (string) {
string = string.replace(/[^A-Za-z0-9]/g, '').toLowerCase()
const reversed = Array.from(string).reverse().reduce((res, cur) => res + cur)
return string === reversed
}
// Do not edit below this line
module.exports = palindromes