Javascript examples for Object:Constructor
Inherit parent constructor arguments
<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>