odin-js-fundamentals-part-4/07_tempConversion/tempConversion.js

15 lines
323 B
JavaScript
Raw Normal View History

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