Access function in closure - Javascript Function

Javascript examples for Function:Closure

Description

Access function in closure

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*from w  w  w .  j a v  a2  s .  c o m*/
(new function(f, arg) {
    this.a = function(x) {
        document.getElementById('out').innerHTML += x;
    }
})['a']('boom.');
    }

      </script> 
   </head> 
   <body> 
      <div id="out">
         out:
         <br> 
      </div>  
   </body>
</html>

Related Tutorials