Skip to content

Instantly share code, notes, and snippets.

@davidrautert
Last active November 13, 2018 20:42
Show Gist options
  • Save davidrautert/fc2e10441d6230b2d38408332088a3e2 to your computer and use it in GitHub Desktop.
Save davidrautert/fc2e10441d6230b2d38408332088a3e2 to your computer and use it in GitHub Desktop.
Checks whether given string is a palindrome
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