The () Operator Invokes the Function

On the previous webpage, the toCelsius refers to the function object, and toCelsius() (with parentheses) refers to the function result. Accessing a function without () will return the function definition:

HTML file: Displayed by browser:
<body>
<p>Accessing a function without (), will return the function definition:<p id="demo"></p>
<script>
function toCelsius(f) {
    return (5/9) * (f-32);
}
   document.getElementById("demo").innerHTML = toCelsius;
</script>
</body>

Accessing a function without (), will return the function definition:


BackTable of ContentsNext