Created
January 23, 2016 22:29
-
-
Save jessycormier/d0e2f22c5e41f350edc4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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