Last active
April 9, 2017 11:42
-
-
Save matchilling/1fb83d8da376818427543fdb6641bda0 to your computer and use it in GitHub Desktop.
Calculate the wind chill factor created by matchilling - https://repl.it/HCIg/0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
/** | |
* Calculate the wind chill factor | |
* @see https://www.weather.gov/media/epz/wxcalc/windChill.pdf | |
* | |
* @param {Float} temperature - temperature in Fahrenheit | |
* @param {Float} windSpeed - wind speed in miles per hour | |
* @return {Float} | |
*/ | |
function calculateWindChillFactor(temperature, windSpeed) { | |
return 35.74 + (0.6215 * temperature) + (0.4275 * temperature - 35.75) * windSpeed ^ 0.16; | |
} | |
const temp = 72, | |
windSpeed = 5.5; | |
console.log( | |
`The chill factor for temperature "${temp}" and wind speed "${windSpeed}" is "${calculateWindChillFactor(temp, windSpeed)}".` | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment