Callback traps and solutions

//Fatal problem in callback function-callback trap (hell)
function fn(fn1) { fn1(function (fn3) { fn3(function (fn5) { fn5(function () {})


    });
});

};
fn(function (fng) {
fn2(function (fn4) {
fn4(function (fn6) {});
});
});

// The solution avoids the above problem through countless .then
function fn(fn1) { return new Promise(() => {

})

}
let promise = fn();
promise.then().then();

Impressions today

Today I learned about my essential problem for such a long time:
being too emotional
most of the time is controlled
by my emotions, causing me to make some unnecessary mistakes.
From now on, I have to learn to control my emotions slowly
. No quarrel, no words when angry, no decision when angry

Guess you like

Origin blog.csdn.net/weixin_50001396/article/details/111827856