javascript closure codes
Dave Partner

javascript closure codes

  • 0 Replies
  • 248 Views

0 Members and 1 Guest are viewing this topic.

*

Offline Cherry Entafield

  • Newbie
  • *
  • 2
  • Gender: Female
  • I'm a Genuis
    • View Profile
javascript closure codes
« on: January 07, 2017, 01:44:44 AM »

<html>
   <head>
      <title></title>
   </head>
   <body>
   
      
      <script type="text/javascript">
          //Closure
          //variable scope reminder
          var countnumber = 2
         
           function add(){ return countnumber = countnumber + 1;}
           function somefunction (){return countnumber; }
           add();
           add();
           add();
           document.write(add())
      </script>
   
   </body>
</html>




 ??? 8) ::)
You can be anything if you put your mind to it