We're a place where coders share, stay up-to-date and grow their careers.
This wouldn't work for "Arara" would it? It'd need some sort of case normalisation.
Also, what about "Taco cat".
The issuer of the challenge, David, said: "Lets keep it simple: only checking for words. No handling for spaces, punctuation or numbers."
But if we're handling capitals and spaces, how about:
let p=s=>(t=>[...t].reverse().join("")==t)(s.toLowerCase().replace(/\s/g,""))
Here,
p("Taco cat") //returns true, p("Arara") //returns true
Another slight mod and we can ignore all non-letter chars (numbers, punctuation, etc.):
let p=s=>(t=>[...t].reverse().join("")==t)(s.toLowerCase().replace(/[^A-z]/g,"")) p("A man, a plan, a canal: Panama.") // returns true
This wouldn't work for "Arara" would it? It'd need some sort of case normalisation.
Also, what about "Taco cat".
The issuer of the challenge, David, said:
"Lets keep it simple: only checking for words. No handling for spaces, punctuation or numbers."
But if we're handling capitals and spaces, how about:
Here,
Another slight mod and we can ignore all non-letter chars (numbers, punctuation, etc.):