Skip to content

Instantly share code, notes, and snippets.

@t0dd
Created May 10, 2013 08:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save t0dd/5553293 to your computer and use it in GitHub Desktop.
Save t0dd/5553293 to your computer and use it in GitHub Desktop.
The constructor pattern - JS OOP.
//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