Javascript examples for Object:Constructor
Create class and then create object from it with new operator
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/* w w w . j a v a 2 s .co m*/ function Developer(skill) { this.skill = skill; this.says = function() { console.log(this.skill + ' rocks!'); } } var john = new Developer('Ruby'); john.says(); } </script> </head> <body> </body> </html>