JSFiddle - React, Tailwind, and code Playground
HTML
<input id="guess" type="text" name="guess">
<button id="guessbutton" type="button" onclick="return answer()">Guess</button>
JavaScript
function answer()
{
var i = 0;
for (i=0; i<4; i++)
{
if (guess == secret)
{
"correct ans!";
}
else if (guess < secret)
{
i++;
"too low";
}
else
{
i++;
"too high";
}
}
}