Skip to content

Instantly share code, notes, and snippets.

@sedera-tax
Last active April 1, 2021 07:01
Show Gist options
  • Save sedera-tax/318e77e71c2b8a250d8d915618787484 to your computer and use it in GitHub Desktop.
Save sedera-tax/318e77e71c2b8a250d8d915618787484 to your computer and use it in GitHub Desktop.
check if string is palindrome or not
function isPalindrome(str)
{
var tab = str.split('');
tab.reverse();
var strReverse = tab.join('');
if (str.toLowerCase() === strReverse.toLowerCase()) {
return true;
}
return false;
}
isPalindrome('sipa'); //false
isPalindrome('Anna'); //true
isPalindrome('Maxam'); //true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment