Não consigo entender como o encadeamento do jQuery funciona [fechado]

Não consigo entender como o encadeamento do jQuery funciona.

jQuery("div").attr("id", "_id")
    .hide()
    .show();

Eu fiz algo como encadeamento, mas não tenho certeza se é a mesma lógica que o jQuery usa.

var fun = (function (parma) {
return function () {
    return {
        start: function () {
            console.log("start");
            return this;
        },

        mid: function () {
            console.log("mid");
            return this;
        },

        last: function () {
            console.log("last");
            return this;
        }
    }
}

}) ();

// Working
fun().start()
    .mid()
    .last();

questionAnswers(5)

yourAnswerToTheQuestion