Files
30-seconds-of-code/snippets/Check_for_palindrome.md
Meet Zaveri e5239d22f0 Update Check_for_palindrome.md
Yes it's working and I double checked
2017-12-12 16:42:59 +05:30

410 B

Check For Palindrome

Steps :

  1. First Converted to form in which no non-alphanumeric character is present i.e. string which is to be compared
  2. Then Converted to palindrome form in which characters will be reversed and will be compared to non-alphanumeric string
palindrome = str => (str.toLowerCase().replace(/[\W_]/g,'').split('').reverse().join('')==str.toLowerCase().replace(/[\W_]/g,''));