Page 1 of 1

Hello, I wanted to make this work by using a for function to verify if a word will be same if reversed. This is my secti

Posted: Sun May 15, 2022 1:32 pm
by answerhappygod
Hello, I wanted to make this work by using a for function to
verify if a word will be same if reversed.
This is my section of code so far I think im getting brainlocked
and cant figure out how to write it.
<!DOCTYPE html>
<html>
<body>
Enter String: <input id="word" />
<p><button
onclick="myFunction();">Check</button>
<div id="result"></div>
<script>
function myFunction() {
var s=document.getElementById("word").value;
var i=1;
var rev;

for(i=string.lenght;i>string.lenght;i--)
if(s==rev)

document.getElementById("result").innerHTML = s+" is
palindrome";
else
document.getElementById("result").innerHTML = s+" is not
palindrome";
}
</script>
</body>
</html>