I have written a web page in JavaScript that calculates your BMI and it seems to work but when I hit the calculate button an alert box pops up and says "your BMI is NaN". I know NaN stands for not a number. I just want to know why I can't get this to work.
<!DOCTYPE html>
<html>
<head>
<title>BMI</title>
</head>
<body>
<p>Your weight:<input type="number" id="value1" /></p>
<p>Your height (in inches):<input type="number" id="value2" /></p>
<script>
function calc() {
var data1 = document.getElementById("value1");
var data2 = document.getElementById("value2");
var weight = (data1 * 703);
var height = (weight) / (data2 * data2);
alert("Your BMI is " + height);
};
</script>
<button onclick="calc()">Calculate</button>
</body>
</html>