odin-default-js-exercises/07_tempConversion/tempConversion.js

18 lines
384 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const convertToCelsius = function(num) {
// °C = (°F 32) x 5/9
let celcius = (num-32)*5/9
return Math.round(celcius * 10)/10
};
const convertToFahrenheit = function(num) {
//°F = (°C × 9/5) + 32
let fahrenheit = (num*9/5)+32
return Math.round(fahrenheit * 10)/10
};
// Do not edit below this line
module.exports = {
convertToCelsius,
convertToFahrenheit
};