Created
April 9, 2013 08:17
-
-
Save ceth-x86/5343918 to your computer and use it in GitHub Desktop.
Javascript : Prototype method
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
function MyClass(name) { | |
this.name = name; | |
} | |
MyClass.prototype.say_hello = function() { | |
alert(this.name); | |
} | |
var s = new MyClass("hello"); | |
s.say_hello(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment