Write a JavaScript program to create a functin that checks whether string is palindrome or not.
Write a JavaScript function that checks whether a passed string is palindrome or not.
<html>
<head>
<title>String Palindrome or not</title>
<script>
function checkPalindrome(str)
{
var s = 0;
var e = str.length-1;
while(s <= e)
{
if(str[s] != str[e])
{
return str + ' -> is not Palindrome.'
}
else
{
s++;
e--;
}
}
return str + ' -> is Palindrome.'
}
document.write(checkPalindrome('madam'));
document.write("<br>");
document.write(checkPalindrome('javascript'));
document.write("<br>");
document.write(checkPalindrome('nitin'));
</script>
</head>
<body>
</body>
</html>
