SOURCE

let name = 'wxq'



// const callBackMethod = (callback => {

//     setTimeout(() => {
//         name = 'wxq_timeout'
//         callback(name)
//     }, 2000)
// })

// callBackMethod((res) => {
//     console.log(res)
// })

const promiseMethod = () => {
    return new Promise(res => {
        setTimeout(() => {
            name = 'wxq_timeout_promise'
            res(name)
        }, 2000)
    })

}


const awaitFun = async () => {

    let newName = await promiseMethod()
    console.log(newName)

}
awaitFun()

console 命令行工具 X clear

                    
>
console