/ Published in: JavaScript
Javascript Method Chaining
source: http://stackoverflow.com/questions/603499/javascript-object-method-chaining-useful
Expand |
Embed | Plain Text
var truck = function() { this.turnLeft = function { // turn left return this; } this.turnRight = function { // turn right return this; } this.goReallyFast = function { // go fast! return this; } }; // My get-away plan var myTruck = new truck(); myTruck.turnLeft().turnRight().goReallyFast();
You need to login to post a comment.
