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>
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
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
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
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!