Skip to content

Instantly share code, notes, and snippets.

@mowamed
Created July 28, 2017 23:22
Show Gist options
  • Save mowamed/f0d3b2a0d2860c517477b7220b7014ab to your computer and use it in GitHub Desktop.
Save mowamed/f0d3b2a0d2860c517477b7220b7014ab to your computer and use it in GitHub Desktop.
palindrome created by mowamed - https://repl.it/Jn8h/0
function palindrome(str) {
// Good luck!
var newStr = str.replace(/\d|\s|\W|_/g, '');
newStr = newStr.toLowerCase();
var myArray = newStr.split('');
if (myArray[0] == myArray[myArray.length - 1]) {
return true
}
return false;
}
palindrome("eye kfgkdsvlksvjsd");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment