Write a program to check whether a given number is a
palindrome or not?
Answer Posted / ankita
//Program to check the given number is palindrome or not//
<html>
<head>
<script language="javascript">
var num,n,rev=0,r;
num=prompt("Enter the number");
n=num;
while(parseInt(num)>0)
{
r=parseInt(num)%10;
rev=parseInt(rev)*10+parseInt(r);
num=parseInt(num)/10;
}
if(rev==parseInt(n))
document.write(n+ " is a palindrome number");
else
document.write(n+ " is not a palindrome number");
</script>
</head>
<body>
</body>
</html>
| Is This Answer Correct ? | 8 Yes | 2 No |
Post New Answer View All Answers
Which built-in method adds one or more elements to the end of an array and returns the new length of the array?
What does two exclamation marks mean in javascript?
How to add new elements dynamically?
what difference between args.length and args.length() in command line argument?
What does "1"+2+3 evaluate to?
Explain the difference between java and javascript.
What is callback in javascript?
How do I use an external javascript file?
What is the use of anonymous function in javascript?
What is namespacing in javascript and how is it used?
What is the difference between the keywords var and let?
What is the difference of "settimeout" function and setinterval functions in javascript
What is closure?
Why is javascript not oop?
What is this? Var myarray = [[[]]];