Skip to content

Instantly share code, notes, and snippets.

@Vincent-gv
Created November 23, 2018 00:53
Show Gist options
  • Save Vincent-gv/359a724c0cd03db4c606304439f8ec51 to your computer and use it in GitHub Desktop.
Save Vincent-gv/359a724c0cd03db4c606304439f8ec51 to your computer and use it in GitHub Desktop.
Temperature conversion
// forecast today
let kelvin = 293;
let celsius = kelvin-273;
let fahrenheit = celsius*(9/5)+32;
let newton = celsius*(33/100);
// .floor() method from the Math library to round down the Fahrenheit temperature
fahrenheit = Math.floor(fahrenheit);
newton = Math.floor(newton);
celsius = Math.floor(celsius);
console.log('The temperature is '+ fahrenheit + ' degrees Fahrenheit. '+ celsius + ' degrees Celsius. ' + newton +
' degrees Newton. ' + kelvin + ' degrees kelvin.');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment