Accessing variable in module - Javascript Object

Javascript examples for Object:Module

Description

Accessing variable in module

Demo Code

ResultView the demo in separate window

<html>
   <head></head>
   <body> 
      <script>
function test() {//from  ww  w  .  j av a2 s  . c  o  m
        var startPoint = "x,y"
        return {
            startPoint: startPoint,
            globalOptions: {
                logo: false,
                center: startPoint
            }
        };
}
console.log(test().startPoint)
console.log(test().globalOptions)

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

Related Tutorials