9 lines
274 B
JavaScript
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
|