This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is a simple program to check whether a string or number is palindrome or not . | |
function palindrome( ) | |
{ | |
var value = ""; | |
var giveme = prompt("enter any string or number" value); | |
var nlen = giveme.length; | |
var inst = ""; | |
var inlst = ""; | |
var rev; | |
inst+= giveme.substr(0, nlen-0); | |
inlst+= giveme.substr(0, nlen); | |
rev = strev(inlst); | |
if(inst == rev) | |
{ | |
console.log("it is palindrome"); | |
} | |
else | |
{ | |
console.log(" oops not palindrome"); | |
} | |
} | |
palindrome(); | |
No comments:
Post a Comment