I am typing an integer in the input box and it still returns 'NaN'.
function goldenFunctiona() {
a = document.getElementById("sidea");
parseInt(a, 10);
b = ((a + a) * (Math.pow(5, 0.5))) / 2;
document.getElementById("b").innerHTML = b;
}
<div id="top">
<p>Side a =</p>
<input id="sidea" type="number">
<button id="button" onclick="goldenFunctiona()" type="button">Find side b</button>
<p id="b"></p>
</div>
I don't know what's going wrong but it's probably something really simple. Thanks in advance.
ais the element, not the input value. TryparseInt(a.value, 10)b.toString()