So I am (still) completely in love with the almighty jQuery, and I have my own growing library of utilities that I want to codify in a java-script object. And I would like t
Something I did really quick but you can relate to the essence of what we are trying to achieve here -
function ChainingObj() {
if (!(this instanceof ChainingObj)) {
return new ChainingObj();
}
}
ChainingObj.prototype.first = function() {
console.log("foo");
return this; //important to return this.
}
ChainingObj.prototype.second = function() {
console.log("bar");
return this;
}
var a = ChainingObj().first().second();