Last active
November 13, 2018 20:42
-
-
Save davidrautert/fc2e10441d6230b2d38408332088a3e2 to your computer and use it in GitHub Desktop.
Checks whether given string is a palindrome
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) { | |
var len = Math.floor(str.length / 2); | |
for (var i = 0; i < len; i++) | |
if (str[i] !== str[str.length - i - 1]) | |
return false; | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment