ES6(Promise)等一个函数执行完后再执行另一个函数

function text1(){
        return new Promise((resolve, reject) => {
            setTimeout(function () {
                resolve(console.log('1111111111'));//返回写函数里面你要执行的内容
            },3000)

        })

    }
    function text2(){
        setTimeout(function () {
                console.log('22222');//返回写函数里面你要执行的内容
            },1000)
    }


    function timeFN(){
        text1().then(() => {
            text2()
        })
    }

    timeFN()

更多参考链接:https://blog.csdn.net/weixin_43023873/article/details/91538556

      https://blog.csdn.net/Dream_Weave/article/details/100788294?depth_1-utm_source=distribute.pc_relevant.none-task&utm_source=distribute.pc_relevant.none-task

原文地址:https://www.cnblogs.com/520BigBear/p/12450027.html