Inherit parent constructor arguments - Javascript Object

Javascript examples for Object:Constructor

Description

Inherit parent constructor arguments

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  w w.j  a v  a 2  s  . com

function MyClass(aNode) {
    this.userData = aNode;
}
MyClass2.prototype = new MyClass();
MyClass2.prototype.constructor=MyClass2;

function MyClass2() {
    MyClass.apply(this, arguments);
    console.log(this.userData);
}
new MyClass2(123);
    });

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

Related Tutorials