Skip to content

Instantly share code, notes, and snippets.

@abrjagad
Created February 13, 2014 09:08
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 abrjagad/8972058 to your computer and use it in GitHub Desktop.
Save abrjagad/8972058 to your computer and use it in GitHub Desktop.
//Invocation as a constructor
//Ninja is a Constructor
//should start with Capital letter
//creates a emply object{}
function Ninja() {
this.skulk = function () {
return this;
};
}
// when assigning, use "new"
var ninja1 = new Ninja();
var ninja2 = new Ninja();
console.log(ninja1.skulk())
console.log(ninja2.skulk())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment