15 lines
323 B
JavaScript
15 lines
323 B
JavaScript
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
|
||
};
|