DEV Community

loading...

Discussion on: Vanilla JavaScript palindrome checker in 3 lines

Collapse
aakatev profile image
Artem • Edited

why i love js, that you can fit it all in one liner 😂 😂 😂

let palindrome = (string) =>
  string.replace(/\s/g, "").toLowerCase() ===
  string.replace(/\s/g, "").toLowerCase().split("").reverse().join("")
Enter fullscreen mode Exit fullscreen mode
Collapse
dailydevtips1 profile image
Chris Bongers Author

True haha!
Need to add this as well, just wanted the exploded view for people to understand

Collapse
mrwebuzb profile image