Write a program to check whether a given number is a
palindrome or not?
Answer Posted / abhijeet gupta
var num=123211;
var str=""+num;
for(var i=0;i<str.length/2;i++){
if(str.charAt(i)!==str.charAt(str.length-1-i)) {
console.log("Not Palindrome");
return;
}
}
console.log("palindrome")
| Is This Answer Correct ? | 3 Yes | 3 No |
Post New Answer View All Answers
List few difference between java and javascript?
How can JavaScript be used?
What is the difference between java & javascript?
What is node ecosystem?
How does javascript work?
How can a value be appended to an array?
What is difference between java and javascript?
Can you give an example showing javascript hoisting?
What is event bubbling in JavaScript?
What is eval() in javascript?
What is difference == and === in javascript?
What is difference between local variable and global?
What is the result of below given line of code in java script? 5+4+'7'?
How to add html elements dynamically with JavaScript?
What is the use of decodeuri() and encodeuri()?