arobida
12/21/2017 - 3:56 PM

[Palindrome] Script to find a palindrome(a word that is spelled the same forward and backward) #vanilla #script

[Palindrome] Script to find a palindrome(a word that is spelled the same forward and backward) #vanilla #script

function palindrome(str) {
  var truth=true;
  var newstr = str.toLowerCase().replace(/[\W_]/g, "");
  var match=newstr.split("");
  match=match.reverse("");
  match=match.join("");

 if(match==newstr){
    return truth;
  } else {
    truth=false;
    return truth;
  }
  return truth;
}



//palindrome("_eye");