snippetjavascriptTip
Convert between Celsius and Fahrenheit in JavaScript
Viewed 0 times
javascriptandbetweenconvertcelsiusfahrenheit
Problem
In order to convert from Celsius to Fahrenheit, you can use the conversion formula
<latex-expression>
</latex-expression>
Conversely, the conversion formula from Fahrenheit to Celsius is
<latex-expression>
F = 1.8 * C + 32.<latex-expression>
</latex-expression>
Conversely, the conversion formula from Fahrenheit to Celsius is
C = (F - 32) * 5 / 9.<latex-expression>
Solution
F = 1.8 \times C + 32</latex-expression>
Conversely, the conversion formula from Fahrenheit to Celsius is
C = (F - 32) * 5 / 9.<latex-expression>
</latex-expression>
Code Snippets
F = 1.8 \times C + 32const celsiusToFahrenheit = degrees => 1.8 * degrees + 32;
celsiusToFahrenheit(33); // 91.4C = (F - 32) \times \frac{5}{9}Context
From 30-seconds-of-code: convert-celsius-fahrenheit
Revisions (0)
No revisions yet.