Skip to content

Latest commit

 

History

History
31 lines (23 loc) · 768 Bytes

convert-celsius-fahrenheit.md

File metadata and controls

31 lines (23 loc) · 768 Bytes
title shortTitle type language tags unlisted cover excerpt dateModified
Convert between Celsius and Fahrenheit in JavaScript
Convert between Celsius and Fahrenheit
tip
javascript
math
true
golden-gate-bridge
Easily apply the Celsius to Fahrenheit and Fahrenheit to Celsius formulas.
2023-09-14

Celsius to Fahrenheit

In order to convert from Celsius to Fahrenheit, you can use the conversion formula F = 1.8 * C + 32.

const celsiusToFahrenheit = degrees => 1.8 * degrees + 32;

celsiusToFahrenheit(33); // 91.4

Fahrenheit to Celsius

Conversely, the conversion formula from Fahrenheit to Celsius is C = (F - 32) * 5 / 9.

const fahrenheitToCelsius = degrees => (degrees - 32) * 5 / 9;

fahrenheitToCelsius(32); // 0