5708c3d85a
Removed generator-exercises folder as it breaks jest-codemods run jest-codemods on .spec.js files, move generator-exercises back in Change references from Jasmine to Jest in main readme Update README with Jest specific language. Update some spec files with new syntax update tests, multiple exercises .gitignore: Added package-lock.json, package.json that were used when I ran code-blocks over the tests. Standardised function declaration calls across exercises fix typo in caesar.spec.js Ignoring package-lock.json, package.json Backtrack on .gitignore modification, add instructions to readme move files from testing repo to this repo Typo fixes, remove duplicate exercise folder Remove solution from non-solution branch Minor grammatical fixes added trailing semicolon to all function and module exports Fix words caught by search/replace action. remove doubled semicolon. Correct words caught by search/replace action. Add missing semicolon. Add .DS_Store to .gitignore multiple files: Added a blank line at the end of each file Ignore generator-exercise when linting exercise files Update exercise number of each exercise Update exercise number
17 lines
941 B
Markdown
17 lines
941 B
Markdown
# 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](https://en.wikipedia.org/wiki/Conversion_of_units_of_temperature).
|
|
|
|
- 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](https://stackoverflow.com/q/7342957/5433628).
|