Alright I'm still new to javascript. I was getting it pretty well, and getting everything alright untill this point.
We have to make a program that test a 5 digit number as a palindrome. I have no clue on how to do this. I was given advice that I'd need to use arrays, but for javascript I have no idea how to work with them. I read some stuff in a book and read some tutorials, but this is the best I can do:
I know I'm probably way off, as the page is just complety blank, but sadly I really have no clue what to do. The first part (Testing to make sure it's a 5 didgit number) I have down. Other than that, I could use any advice that could be given .
Thank you for your time and help.
We have to make a program that test a 5 digit number as a palindrome. I have no clue on how to do this. I was given advice that I'd need to use arrays, but for javascript I have no idea how to work with them. I read some stuff in a book and read some tutorials, but this is the best I can do:
Code:
var numa
var pal = new Array(5)
numa = window.prompt( "Please enter a five digit number number");
num1 = parseInt ( numa );
while (numa < 10000 || numa > 99999 )
{
window.alert ("The number is not 5 digits please enter a 5 digit number ");
numa = window.prompt( "Please enter a five digit number number");
}
for (var i = 0; i < 5; ++i)
{pal[ num1 ] = numa;
}
pal.test (compareIntegers );
function compareIntegers(vaule1, vaule2, vaule4, vaule5)
{
if (vaule1 == vaule5 );
{
if (vaule2 == vaule4 )
{
doucment.writeln ( "The number is a palindrome")
}
}
else
document.writeln ("The number is not a palindrome")
}
Thank you for your time and help.
Comment