SOURCE

console 命令行工具 X clear

                    
>
console
let a = function (btn) {
    return new Promise((resolve, reject) => {
        if (btn) {
            resolve("true")
        } else {
            reject("false")
        }
    }).then(res => {
        console.log('a___' + res)
        return res
    })
        .catch(err => {
            console.log('a___' + err)
            return err
        })
}
let b = function (b) {
    return new Promise((resolve, reject) => {

        if (b == 'true') {
            resolve(b)
        } else {
            reject(b)
        }
    })
        .then(res => {

            let a = 'b___' + res
            console.log(a)
            return a
        })
        .catch(res => {
            let a = 'b____' + res
            console.log(a)
            return a
        })
}

async function fn() {
    let h1 = await a(false)
    if (h1 == "true") {
        h1 = await b(h1)
    }
    return h1
}


fn().then(res => {
    console.log('asycn___' + res)
})
    .catch(res => {
        console.log('asycn___' + res)

    })
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <title>Document</title>
</head>
<body>
  
</body>
</html>