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 |
How do you check if a string is a number javascript?
What is a javascript symbol?
What are events in javascript?
What are the characteristics of javascript ‘strict mode’?
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; }
What is use of object as function?
What is event target in javascript?
How to write a script for "select" lists using javascript
what is the difference between wrappers and primitives es: diff between int i=200 in primitives and integeri = new integer(54)
How do you target a specific frame from a hyperlink in javascript?
How to loop through array in javascript?
What are the problems associated with using javascript, and are there javascript techniques that you discourage?