Skip to content

Instantly share code, notes, and snippets.

@zafe
Last active August 29, 2015 14:19
Show Gist options
  • Save zafe/204b1bc850897a6bbb5e to your computer and use it in GitHub Desktop.
Save zafe/204b1bc850897a6bbb5e to your computer and use it in GitHub Desktop.
palindrome() function
function ispalindrome(){
var palindrome = true;
var text = "arra";
var array = text.toUpperCase();
array = array.split(" ");
array = array.join("");
for(var i in array)
{
if(array[i] != array[array.length - i - 1])
{
palindrome = false;
break;
}
}
if(palindrome) console.log("PALINDROME")
else console.log("NOT A PALINDROME");
}
ispalindrome();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment