JSFiddle - React, Tailwind, and code Playground

by puuga

HTML

<input id="input" onchange="goo()" onkeyup="goo()"></input>
<div id="output"></div>

JavaScript

// palindrome

function goo() {
    var input = document.getElementById("input").value;
    document.getElementById("output").innerHTML = isPalindrome(input);
}

function isPalindrome(text) {
    for(i=0; i<text.length; i++){
        if(text[i]!=text[text.length-1-i])
            return false;
    }
    return true
}