Recently started learning JavaScript and facing an issue. I'm trying to create a program where the user inputs a number into a text box, clicks a button, and then an alert box displays the Square Root of their number. However, whenever the alert appears, it shows 'NaN' as the message? Can anyone provide some guidance?
function calculate(){
var inputNumber = Number(document.getElementById("inputValue"));
alert(Math.sqrt(parseFloat(inputNumber)));
}
Appreciate any help! Thanks!