HTML code:
<input type="text" id="iop">
<button onclick=suh()>Calculate</button>
<p id="final"></p>
Javascript code:
let iop=document.getElementById('iop').value;
let num=parseFloat(iop);
function suh(){
document.getElementById('final').innerHTML=`The square of the number entered is ${num}`;
}
The output is: The square of the number entered is NaN