ES6(Promise)等一个函数执行完后再执行另一个函数
时间:2020-03-09 20:00:09
收藏:0
阅读:1143
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://www.cnblogs.com/520BigBear/p/12450027.html
评论(0)