Skip to content

Instantly share code, notes, and snippets.

@ali-master
Created September 11, 2021 00:39
Show Gist options
  • Save ali-master/c40222a4cb96914073a1ef43356d1783 to your computer and use it in GitHub Desktop.
Save ali-master/c40222a4cb96914073a1ef43356d1783 to your computer and use it in GitHub Desktop.
Two functions to convert from Celsius to Fahrenheit and back in Javascript
function toCelsius(fahrenheit) {
return (fahrenheit - 32) * 5 / 9;
}
function toFahrenheit(celsius) {
return (celsius * 9 / 5) + 32;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment