減少壓痕
承諾:
function doTheThing() {
    return doOneThing()
        .then(doAnother)
        .then(doSomeMore)
        .catch(handleErrors)
}
使用非同步功能:
async function doTheThing() {
    try {
        const one = await doOneThing();
        const another = await doAnother(one);
        return await doSomeMore(another);
    } catch (err) {
        handleErrors(err);
    }
}
請注意返回值是在底部,而不是在頂部,並且你使用語言的本機錯誤處理機制(try/catch)。