Skip to content
Advertisement

Tag: chainable

How to make chainable function in JavaScript?

Lets imagine function like this: Usage of it would be like: I’m looking for a way to create function that’s chainable with other functions. Imagine usage: How would I do this? Answer Sure, the trick is to return the object once you’re done modifying it: http://jsfiddle.net/Xeon06/vyFek/ To make the method available on String, I’m modifying it’s prototype. Be careful not

Advertisement