Hello I am writing code in javascript to find out if 4 digits number is palindrome or not. First I check if the number has for digits and if it does I find every digit using / and % and then check if the first digit matches the last and the second digit matches the third digit. The thing is the result is always number not palindrom.Can someone help me out?
var numri = window.prompt("Vendosni numrin");
numri = parseInt(numri);
while (numri > 9999 || numri < 1000) {
alert("Number not 4 digits");
var numri = window.prompt("Vendosni numrin");
numri = parseInt(numri);
}
var shifra4 = numri % 10;
numri = numri / 10;
var shifra3 = numri % 10;
numri = numri / 10;
var shifra2 = numri % 10;
var shifra1 = numri / 10;
if (shifra4 == shifra1 && shifra2 == shifra3)
alert("Number palindrome");
else
alert("Number not palindrome");