Javascript examples for Object:Object Property
Sharing methods and properties between Object classes
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//from w w w.ja v a2s .co m function MyClass(){ } var myClass = new MyClass(); myClass.constructor.prototype.sayHi = function(){ console.log("Hi"); }; var myClass2 = new MyClass(); myClass2.sayHi(); } </script> </head> <body> </body> </html>