Created
July 24, 2015 18:10
-
-
Save grippado/f5e4184843cc848e8249 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form id="palinChecker"> | |
<input id="input" /> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var palindromo = function (string) { | |
if (string == string.split('').reverse().join('')) { | |
alert(string + ' é palindromo!'); | |
} | |
else { | |
alert(string + ' não é palindromo!'); | |
} | |
} | |
document.getElementById('palinChecker').onsubmit = function() { | |
palindromo(document.getElementById('input').value); | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment