Write a program to check whether a given number is a
palindrome or not?
Answers were Sorted based on User's Feedback
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 |
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 |
What does the delete operator do?
What is "strict mode" and how is it used in JavaScript?
What is the difference between the substr() and substring() functions in javascript?
What does polyfill mean?
How about 2+5+"8"?
Can we create buttons in JavaScript ? if yes how? pls provide sample code... Thanks in advance.....
Is array a data type in javascript?
What is the disadvantage of javascript?
What is callback?
How to call a function in every x seconds in javascript?
How many types of variables are there in javascript?
What are the string methods?