Computer >> Computer tutorials >  >> Programming >> Javascript

How to invoke a JavaScript Function as a function?


To invoke a JavaScript function as a function, call it like a normal custom JavaScript function.

Example

You can try to run the following code to call a JavaScript function as a function −

<html>
   <head>
      <script>
         function Display()
         {
            document.write ("Hello World!");
         }
      </script>
   </head>
 
   <body>
      <p>Click the following button to call the function</p>
      <form>
         <input type = "button" onclick = "Display()" value = "Display">
      </form>
   </body>
</html>