Last active
August 29, 2015 14:05
-
-
Save harisrozak/ff2da06380f247df8924 to your computer and use it in GitHub Desktop.
JS :: Sample Javascript Prototype
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Hello = function() | |
{ | |
this.a = 1; | |
} | |
Hello.prototype.dolly = function() | |
{ | |
this.b = 2; | |
this.c = this.a + this.b; | |
return this; | |
} | |
world = new Hello(); | |
console.log(world.dolly().c); // will return: 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment