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

25 lines
474 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(faren) {
// [°F] = [°C] × 95 + 32
var toC = ((faren - 32) * (5/9));
toC = Math.round(toC * 10) / 10;
return toC;
};
const ctof = function(celsius) {
// [°C] = ([°F] 32) × 59
var toF = ((celsius * 1.8) + 32);
toF = Math.round(toF * 10) / 10;
return toF;
};
var testVar = ftoc(32);
var testVar2 = ctof(0);
console.log(testVar);
console.log(testVar2);
// Do not edit below this line
module.exports = {
ftoc,
ctof
};