JSFiddle - React, Tailwind, and code Playground

by GolezTrol

HTML

<div id='main'>
    <input type="number" name="power2" placeholder='Enter the power' id='inputin'><br/>
    <button id="submit" onclick="binaryS()">Do it!</button>
   <span id="answer"></span>
</div>

JavaScript

//console.log = window.alert;

binaryS = function() {
x = document.getElementById("inputin").value;
y=1;
for(i=1;i<=x;i++) {
    y=y*2;
}
document.getElementById("answer").innerText = y;
    
};