Last active
February 14, 2023 12:47
-
-
Save dcortesnet/292326528cbe4e8ee5eb0df9650137d2 to your computer and use it in GitHub Desktop.
Javascript verificación de palindromos
This file contains hidden or 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 isPalindrome(str) { | |
| const replaceStr = str.replace(/[^A-Za-z0-9]/g, '').toLowerCase(); | |
| const reverseString = replaceStr.split('').reverse().join(''); | |
| return replaceStr === reverseString; | |
| } | |
| console.log(isPalindrome("EYES")); // true | |
| console.log(isPalindrome("not is palindrome")); // false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment