I’m doing a basic program for my beginners coding class. This assignment is on functions. I need to use a function to call on another and the second returns a value to the first for output to the user. This particular program is to determine the Wind Chill in Fahrenheit using two user inputs. I keep getting an error in debugging telling me the variable I’ve assigned for the return is not assigned. But a couple lines above it is assigned. I’ve banged my head a bunch, re-read the class material, and compared my code to the code examples given in class. Please let me know what I am missing. Thank you.
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<title>Find Wind Chill In Fahrenheit</title>
<script language="javascript" type="text/javascript">
function doInputOutput () {
//Can I remove the var from the input?
var temp = parseFloat (document.getElementById('temp').value);
var windSpeed = parseFloat (document.getElementById('windSpeed').value);
//windChill();
var itsCold = windChill(temp,windSpeed)
var div = document.getElementById ('output');
div.innerHTML = itsCold;
}
function windChill (t,v) {
var itFeelsLike = 35.74 + 0.6215 * t -35.75* a + .4275 * t * a;
var a = Math.pow(v,.16);
//I got the formula from www.onlineconversion.com/windchill.htm.
//I verified the formula from a few separate sources as well
//var itFeelsLike =___________
return itFeelslike;
}
</script>
</head>
<body>
<input type="text" id="temp"> Temperature </input>
<input type="text" id="windSpeed"> Wind Speed </input>
</br>
</br>
<button type="button" onClick="doInputOutput();">Wind Chill</button>
<!--<button type="button" onclick="fifteen();">Click</button>-->
<div id="output"></div>
</body>
</html>