Skip to content

Instantly share code, notes, and snippets.

@liseferguson
Created March 10, 2018 01:28
Show Gist options
  • Save liseferguson/3d1ac7e3066492273bcf3e1b405d433f to your computer and use it in GitHub Desktop.
Save liseferguson/3d1ac7e3066492273bcf3e1b405d433f to your computer and use it in GitHub Desktop.
Fahrenheit and Celcius temperature conversions
function celsToFahr(celsTemp) {
return celsTemp * 9/5 + 32;
}
function fahrToCels(fahrTemp) {
return (fahrTemp - 32) * 5/9;
}
/* From here down, you are not expected to
understand.... for now :)
Nothing to see here!
*/
// tests
function testConversion(fn, input, expected) {
if (fn(input) === expected) {
console.log('SUCCESS: `' + fn.name + '` is working');
return true;
} else {
console.log('FAILURE: `' + fn.name + '` is not working');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment