how to Declare a global variable and local variable in java script

global variable and local variable


<html>
   <body onload = checkscope();>
      <script type = "text/javascript">
         <!--  
            function checkscope( ) {
      var myVar = "global"; // Declare a global variable
                var myVar = "local";  // Declare a local variable

               document.write(myVar);
            }
         //-->
      </script>
   </body>
</html>

Comments

Popular posts from this blog

java script book in PDF format