Skip to content

Instantly share code, notes, and snippets.

@kswlee
Created July 13, 2013 05:13
Show Gist options
  • Select an option

  • Save kswlee/5989493 to your computer and use it in GitHub Desktop.

Select an option

Save kswlee/5989493 to your computer and use it in GitHub Desktop.
function Waffle() {
if (!(this instanceof Waffle)) {
return new Waffle();
}
this.tastes = "yummy";
}
Waffle.prototype.wantAnother = true;
// testing invocations
var first = new Waffle(),
second = Waffle();
console.log(first.tastes); // "yummy"
console.log(second.tastes); // "yummy"
console.log(first.wantAnother); // true
console.log(second.wantAnother); // true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment