return function by var from another function - Javascript Function

Javascript examples for Function:Function Return

Description

return function by var from another 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">
    window.onload=function(){//from   w ww .ja  v  a 2s.c om
function dataset() {
   var myData = {
       url: "www.example.com",
       name: "test",
       version: "1.00"
   };
   return myData;
}
var myVar = dataset();
document.getElementById("result").innerHTML = myVar.name;
    }

      </script> 
   </head> 
   <body> 
      <div id="result"> 
      </div>  
   </body>
</html>

Related Tutorials