Skip to content

Instantly share code, notes, and snippets.

@mindplace
Created March 23, 2016 02:16
Show Gist options
  • Select an option

  • Save mindplace/c28759775cb2c31c680c to your computer and use it in GitHub Desktop.

Select an option

Save mindplace/c28759775cb2c31c680c to your computer and use it in GitHub Desktop.
function temperatureConversion(temp, toNewType) {
if ((toNewType[0] === "c") || (toNewType[0] === "C")) {
// convert to celsius
console.log((temp - 32) * (5/9))
}
else {
// convert to fahrenheit
console.log((temp * 9/5) + 32)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment