In most languages, chaining is based on whatever is returned. In other words, the return from the method is passed to the chained method as this. It can be the previous method's this, or anything else that you might return.
For instance, with fetch:
fetch returns a new Promise object. That Promise object has a method called then() attached to it.