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

13 lines
288 B
JavaScript
Raw Permalink Normal View History

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