[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");