Create a callable prototype method within another prototype - Javascript Object

Javascript examples for Object:prototype

Description

Create a callable prototype method within another prototype

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 . j av  a2  s.  c  o  m
Parent = {};
Parent.__proto__ = { child: function(arg) { console.log(arg); } };
Parent.child('test')
console.log(Parent);
    }

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

Related Tutorials