Last active
April 1, 2021 07:01
-
-
Save sedera-tax/318e77e71c2b8a250d8d915618787484 to your computer and use it in GitHub Desktop.
check if string is palindrome or not
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 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