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

13 lines
288 B
JavaScript
Raw Permalink Normal View History

2023-01-21 17:53:41 +00:00
const convertToCelsius = function (fahrenheit) {
return Math.round((fahrenheit - 32) * (5 / 9) * 10) / 10;
2022-02-20 19:07:44 +00:00
};
2023-01-21 17:53:41 +00:00
const convertToFahrenheit = function (celsius) {
return Math.round(((celsius * 9) / 5 + 32) * 10) / 10;
2022-02-20 19:07:44 +00:00
};
module.exports = {
2023-01-21 17:53:41 +00:00
convertToCelsius,
convertToFahrenheit,
2022-02-20 19:07:44 +00:00
};