Javascript examples for Object:Constructor
defining Constructor in Javascript
<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 va2 s . c om*/ function my() { // This is contructor method console.log('hello world!'); this.init(); } my.prototype = { constructor: my, init: function() { console.log('hello world!'); } }; var my = new my(); } </script> </head> <body> </body> </html>