Created
November 23, 2018 00:53
-
-
Save Vincent-gv/359a724c0cd03db4c606304439f8ec51 to your computer and use it in GitHub Desktop.
Temperature conversion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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