Skip to content

Instantly share code, notes, and snippets.

@ariesabao
Created August 8, 2018 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ariesabao/24593847e1de283febcac99ce172968a to your computer and use it in GitHub Desktop.
Save ariesabao/24593847e1de283febcac99ce172968a to your computer and use it in GitHub Desktop.
JavaScript Algorithms and Data Structures Projects
function palindrome(str) {
str = str.toLowerCase().replace(/[\W_]/g, '');
for(var i = 0, len = str.length - 1; i < len/2; i++) {
if(str[i] !== str[len-i]) {
return false;
}
}
return true;
}
palindrome("eye");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment