Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript Functions</h1> <p>Using a function as a variable:</p> <p id="demo"></p> <script> let text = "The temperature is " + toCelsius(77) + " Celsius."; document.getElementById("demo").innerHTML = text; function toCelsius(fahrenheit) { return (5/9) * (fahrenheit-32); } </script> </body> </html>