Skip to content

Instantly share code, notes, and snippets.

@jessycormier
Created January 23, 2016 22:29
Show Gist options
  • Save jessycormier/d0e2f22c5e41f350edc4 to your computer and use it in GitHub Desktop.
Save jessycormier/d0e2f22c5e41f350edc4 to your computer and use it in GitHub Desktop.
(function(){
'use strict';
var X = function (val) {
console.log('instance created');
this.name = val;
};
X.prototype.foo = function() {
this.name += ' +foo';
return this;
};
X.prototype.bar = function() {
this.name += ' +bar';
return this;
};
X.prototype.toString = function() {
return this.name;
};
var y = new X('testing');
console.log(y.foo().foo().bar());
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment