Created
February 5, 2021 22:58
-
-
Save jloescher/11cc7a7689c51ce18fe883ae5dfcbd45 to your computer and use it in GitHub Desktop.
Temperature unit conversion JS
This file contains hidden or 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
// Holds the constant value of the kelvin tempature | |
const kelvin = 0; | |
// Convert kelvin to celsius | |
const celsius = kelvin - 273; | |
// Convert celsius to fahrenheit | |
let fahrenheit = celsius * (9/5) + 32; | |
// Rount the value from the quation to the nearest whole number. | |
fahrenheit = Math.floor(fahrenheit); | |
console.log(`The temperature is ${fahrenheit} degrees Fahrenheit.`); | |
// Convert celsius to newtons | |
let newton = celsius * (33/100); | |
newton = Math.floor(newton); | |
console.log(newton) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment