Created
May 10, 2013 08:56
-
-
Save t0dd/5553293 to your computer and use it in GitHub Desktop.
The constructor pattern - JS OOP.
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
//The constructor pattern | |
function Robot(name, model, job){ | |
this.name = name; | |
this.model = model; | |
this.job = job; | |
this.sayMyName = function() { | |
alert(this.name); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment