So ... messing with JavaScript with an idea that is new to me, with the Object methods returns the Object object of which they are a part; this leads to adhesion. Then my question is: how can this be useful? I threw this together to check out the main works:
<script> MathChain = function() { this.pass = function() { this.multiply = eval(arguments.join('*')); this.add = eval(arguments.join('+')); return this; } } m = new MathChain().pass(5, 10, 20).multiply; </script>
This is clearly not a malevolently efficient instance in which to use this concept, so that you could tell me what does it right (except for jQuery, please)?
javascript object method-chaining
Hexagon Theory Mar 02 '09 at 18:48 2009-03-02 18:48
source share