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

20 lines
382 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const ftoc = function(tempF) {
// [°C] = ([°F] 32) × 59
let fToC = ((tempF - 32.0) * (5/9))
let fixed = fToC.toFixed(1)
return parseFloat(fixed)
};
const ctof = function(tempC) {
// [°F] = [°C] × 95 + 32
let cToF = ((tempC * (9/5)) + 32.0)
let fixed = cToF.toFixed(1)
return parseFloat(fixed)
};
// Do not edit below this line
module.exports = {
ftoc,
ctof
};