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

18 lines
329 B
JavaScript
Raw Permalink Normal View History

2023-06-19 16:36:59 -07:00
const round = function (number) {
return Math.round(number * 10) / 10
}
2017-08-25 08:27:07 -07:00
2023-06-19 16:36:59 -07:00
const convertToCelsius = function (F) {
return round((F - 32) * (5 / 9))
}
const convertToFahrenheit = function (C) {
return round((C * (9 / 5)) + 32)
}
2017-08-25 08:27:07 -07:00
// Do not edit below this line
2017-08-25 08:27:07 -07:00
module.exports = {
convertToCelsius,
2023-06-19 16:36:59 -07:00
convertToFahrenheit,
}