How to invoke a JavaScript Function as a function?

JavascriptWeb DevelopmentFront End Technology

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>
raja
Published on 23-Feb-2018 12:23:12
Advertisements