Skip to content

Instantly share code, notes, and snippets.

@rwaldron
Created September 28, 2010 19:36
Show Gist options
  • Select an option

  • Save rwaldron/601636 to your computer and use it in GitHub Desktop.

Select an option

Save rwaldron/601636 to your computer and use it in GitHub Desktop.
var X = function () {
return new X.prototype.init() ;
};
X.prototype = {
init: function () {
this.y = 0;
return this;
},
y: 1
};
X.prototype.init.prototype = X.prototype;
X.prototype.y = 1;
console.log(X());
console.log(X.y); //undefined
console.log(X().y);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment