JSFiddle - React, Tailwind, and code Playground
HTML
<button type="button" id="checkPalindrome">Check that it is Palindrome</button>
<input type="text" id="input">
<div>
Is number a
<a target="_blank" href="https://www.google.co.il/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0CCoQFjAB&url=http%3A%2F%2Fwww.irisim.karmiel.k12.il%2Flearn%2Fmath%2Fhidot%2Fp-polindrom.doc&ei=LZA-VYy0KsfnaobjgKgE&usg=AFQjCNF_O4MsS0qdp5XLaxKoYE1uVFzJIw&sig2=pQjsVRY7SO4vy9Zs4o_Xwg&bvm=bv.91665533,d.d2s">Palindrome</a>?
<span id="result">(result will be here)</span>
</div>
JavaScript
/* TODO: check if a number is a פילנדום on input's content change */
$("#checkPalindrome").click(function () {
var input = $("#input").val();
$("#result").text(isPalindrome());
});
function isPalindrome(S) {
var array = input.split("");
var i = 0;
var j = array.length-1;
while (i < j) {
if (array[i] != array[j]) {
return false;
} else {
i++;
j--;
}
}
return true;
}