Skip to content

Instantly share code, notes, and snippets.

@dcortesnet
Last active February 14, 2023 12:47
Show Gist options
  • Select an option

  • Save dcortesnet/292326528cbe4e8ee5eb0df9650137d2 to your computer and use it in GitHub Desktop.

Select an option

Save dcortesnet/292326528cbe4e8ee5eb0df9650137d2 to your computer and use it in GitHub Desktop.
Javascript verificación de palindromos
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