Command Palette

Search for a command to run...

Hectal
Phase 3: Functions
JavaScript · Exercise 2 of 6 PreviousNext
Beginner

Temperature converters as arrows

Write two arrow functions with concise bodies (no braces, no return keyword):

toCelsius(f) returns (f - 32) * 5 / 9, and toFahrenheit(c) returns c * 9 / 5 + 32.

For example, toCelsius(212) is 100 and toFahrenheit(100) is 212.

What Check tests

  1. toCelsius(212) is 100 and toCelsius(32) is 0
  2. toFahrenheit(100) is 212 and toFahrenheit(0) is 32
  3. Both agree at -40 (the one temperature where the scales meet)
  4. Both are arrow functions

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Console

Nothing printed yet.