Convert Fahrenheit to Celsius
Let's start by defining the function convertFahrenheitToCelsius
that takes a number (fahrenheit
) as a parameter.
function convertFahrenheitToCelsius(fahrenheit) { // Function body will go here }
To convert Fahrenheit to Celsius, we use the formula: Celsius = (Fahrenheit - 32) * 5/9
.
function convertFahrenheitToCelsius(fahrenheit) { // Convert Fahrenheit to Celsius const celsius = (fahrenheit - 32) * 5/9; // Return the converted temperature in Celsius return celsius; }