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

Set the variables to different values and different operators and then try...

auto redirected page in java script