Change a global variable from within a function - Javascript Data Type

Javascript examples for Data Type:Variable Scope

Description

Change a global variable from within a 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">
var winversion;//from w  ww . ja v a  2  s  . c  om
function setwinver(ver) {
    console.log(ver);
    winversion = ver;
}

      </script> 
   </head> 
   <body> 
      <h1>Index page</h1> 
   </body>
</html>

Related Tutorials