Skip to content

Instantly share code, notes, and snippets.

@matchilling
Last active April 9, 2017 11:42
Show Gist options
  • Save matchilling/1fb83d8da376818427543fdb6641bda0 to your computer and use it in GitHub Desktop.
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
'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