Immediately invoke function :- JavaScript


  • This types of function is called anonymous function.
  • In this example defined function is called before DOM is initialize.
  • This function call before execute the document ready statement.
Code:-

  1. <!DOCTYPE html> 
  2. <html> 
  3.  
  4. <head> 
  5.  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  6.  
  7.  <script> 
  8.   (function() 
  9.   { 
  10.    alert("Invoked"); 
  11.   })() 
  12.  </script> 
  13.  
  14. </head> 
  15.  
  16. <body> 
  17.  
  18. </body> 
  19.  
  20. </html>
Immediately invoke function :- JavaScript Immediately invoke function :- JavaScript Reviewed by Network security on November 11, 2019 Rating: 5

No comments:

Useful Information

Powered by Blogger.