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

14 lines
282 B
JavaScript
Raw Normal View History

const convertToCelsius = function(fahrenheit) {
2022-11-19 14:09:51 +00:00
return Math.round((fahrenheit - 32) * (5/9) * 10) / 10;
};
2017-08-25 15:27:07 +00:00
const convertToFahrenheit = function(celsius) {
return Math.round(((celsius * 9/5) + 32) * 10) / 10;
};
2017-08-25 15:27:07 +00:00
2017-08-25 15:27:07 +00:00
module.exports = {
convertToCelsius,
convertToFahrenheit
};