odin-default-js-exercises/tempConversion
Michael Frank 06e90f66c8 pulled eslint files from jester-tester and updated exercise numbers 2021-05-12 21:37:19 +12:00
..
README.md pulled eslint files from jester-tester and updated exercise numbers 2021-05-12 21:37:19 +12:00
tempConversion.js Grammar cleanups, trailing semicolon for function expressions 2021-05-10 20:08:31 +12:00
tempConversion.spec.js move files from testing repo to this repo 2021-04-30 21:49:46 +12:00

README.md

Exercise 07 - tempConversion

Write two functions that convert temperatures from Fahrenheit to Celsius, and vice versa:

ftoc(32) // fahrenheit to celsius, should return 0

ctof(0) // celsius to fahrenheit, should return 32

Because we are human, we want the result temperature to be rounded to one decimal place: i.e., ftoc(100) should return 37.8 and not 37.77777777777778.

This exercise asks you to create more than one function so the module.exports section of the spec file looks a little different this time. Nothing to worry about, we're just packaging both functions into a single object to be exported.

Hints

  • You can find the relevant formulae on Wikipedia.

  • Try to find by yourself on the Internet how to round a number to 1 decimal place in JavaScript. If you struggle, have a look here.