Run nested function - Javascript Function

Javascript examples for Function:Function Recursion

Description

Run nested function

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() {//  www  .jav  a2s  . c  o  m
var m = 0;
var d = 0;
console.log(m+++":" + ++d);
function getCtr() {
    var i = 0;
    return function() {
        console.log(++i);
    }
}
var ctr = getCtr();
ctr();
ctr();
    });

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials