Write a program to check whether a given number is a
palindrome or not?

Answers were Sorted based on User's Feedback



Write a program to check whether a given number is a palindrome or not?..

Answer / 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

Write a program to check whether a given number is a palindrome or not?..

Answer / annshuk

function isPalidrome(str){
if(str== str.split('').reverse().join())
return str +"is palidrome";
else return str +"try another string";
}

Is This Answer Correct ?    0 Yes 4 No

Write a program to check whether a given number is a palindrome or not?..

Answer / james

102101

Is This Answer Correct ?    3 Yes 9 No

Post New Answer

More JavaScript Interview Questions

How do you check if a string is a number javascript?

0 Answers  


What is a javascript symbol?

0 Answers  


What are events in javascript?

0 Answers  


What are the characteristics of javascript ‘strict mode’?

0 Answers  


What is missing in my code? function numberTally(numList) { var evenTotal = 0; var oddTotal = 0; for (var i = 0; i <= numList.length; i++) { if i % 2 { // i is odd oddTotal += numList[i]; // or oddTotal = oddTotal + numList[i]; } else { // i is even evenTotal + numList[i]; } } alert(oddTotal); return evenTotal; }

0 Answers  






What is use of object as function?

0 Answers  


What is event target in javascript?

0 Answers  


How to write a script for "select" lists using javascript

0 Answers  


what is the difference between wrappers and primitives es: diff between int i=200 in primitives and integeri = new integer(54)

0 Answers  


How do you target a specific frame from a hyperlink in javascript?

0 Answers  


How to loop through array in javascript?

0 Answers  


What are the problems associated with using javascript, and are there javascript techniques that you discourage?

0 Answers  


Categories