2023-06-19 17:06:09 -07:00
|
|
|
const palindromes = function (string) {
|
|
|
|
string = string.replace(/[^A-Za-z0-9]/g, '').toLowerCase()
|
|
|
|
const reversed = Array.from(string).reverse().reduce((res, cur) => res + cur)
|
2017-08-25 12:07:28 -07:00
|
|
|
|
2023-06-19 17:06:09 -07:00
|
|
|
return string === reversed
|
|
|
|
}
|
2017-08-25 12:07:28 -07:00
|
|
|
|
2021-09-11 15:18:19 -07:00
|
|
|
// Do not edit below this line
|
2023-06-19 17:06:09 -07:00
|
|
|
module.exports = palindromes
|