2.
What is the output of the following JavaScript code?
function convertFahrenheitToCelsius(fahrenheit) {
return (fahrenheit - 32) * 5 / 9;
}
var result = convertFahrenheitToCelsius(100);
console.log(result);
1340
undefined
100
37.77777777777778
Correct: D
The code defines a function convertFahrenheitToCelsius that takes a value in Fahrenheit as a parameter and returns the equivalent value in Celsius. The code then calls this function with an argument of 100 and assigns the returned value to the result variable. Finally, result is printed to the console. The correct output is 37.77777777777778.