Last active
March 10, 2022 10:13
-
-
Save polinabee/b1d2e633bc666c29c42afb8bda7e4478 to your computer and use it in GitHub Desktop.
Have the function PalindromeTwo(str) take the str parameter being passed and return the string true if the parameter is a palindrome, (the string is the same forward as it is backward) otherwise return the string false. The parameter entered may have punctuation and symbols but they should not affect whether the string is in fact a palindrome. F…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function PalindromeTwo(str) { | |
if (str.toLowerCase().replace(/[^a-z]/g, '') == str.toLowerCase().replace(/[^a-z]/g, '').split('').reverse().join('')){ | |
return true; | |
} | |
return false; | |
} | |
PalindromeTwo(readline()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment