#855·q

Why return function ref ?

Author: indownCreated Dec 6, 2021Updated Dec 7, 2021

Now, we need to start altering our "then" methods so that they return promises for the return value of their given callback. The "ref" case is simple. We'll coerce the return value of the callback to a promise and return that immediately.

var ref = function (value) {
    if (value && typeof value.then === "function")
        return value;
    return {
        then: function (callback) {
            return ref(callback(value));
        }
    };
};

I try only to use "return callback(value)", It doesn't seem to be a problem,Can you provide an example (" return callback(value) ")?
Thanks.