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

21 lines
414 B
JavaScript
Raw Normal View History

2023-11-04 11:05:11 +00:00
const convertToCelsius = function(temp) {
let Ftemp = temp;
let intoCelsius = (Ftemp - 32)* 5/9
return Math.round(intoCelsius*10)/10;
};
2017-08-25 15:27:07 +00:00
2023-11-04 11:05:11 +00:00
const convertToFahrenheit = function(temp) {
let cTemp = temp;
let intoFahrenheit = (cTemp * 9/5 + 32)
return Math.round(intoFahrenheit* 10) / 10;
};
2017-08-25 15:27:07 +00:00
2023-11-04 11:05:11 +00:00
convertToCelsius(32)
convertToFahrenheit(0)
2017-08-25 15:27:07 +00:00
module.exports = {
convertToCelsius,
convertToFahrenheit
};