Passing Object parameters to a function - Javascript Function

Javascript examples for Function:Function Argument

Description

Passing Object parameters to 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">
    window.onload=( function() {//from   ww  w .  j  ava2 s .c o  m
    func(test = {
        item: {
             subItem: 1
        },
        item2: {
             message: 'test'
        }
    },test.item2.message += ' ' + test.item.subItem );
    function func ( obj ) {
        console.log( obj.item2.message );
    }
    });

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

Related Tutorials