SOURCE

function getdata () {
    return new Promise((resolve,reject)=>{
        resolve('getdata')
    })
}

function getdata2 () {
    return new Promise((resolve,reject)=>{
        resolve('getdata2')
    })
}

function getdata3 () {
    return new Promise((resolve,reject)=>{
        resolve('getdata3')
    })
}

async function get_all_data() {
   let getdata_one   =  await  getdata()
   let getdata_two   =  await  getdata2()
   let getdata_three =  await  getdata3()
   console.log('jjjj')
   console.log(getdata_one,1)
   console.log(getdata_two,22)
   console.log(getdata_three,333)
}

// 三个异步函数 的实践且简化了then()函数
get_all_data()

function timeout(ms) {
  return new Promise((resolve) => {
    setTimeout(resolve, ms);
  });
}

async function asyncPrint(value, ms) {
  await timeout(ms);
  console.log(value);
}

asyncPrint('hello world', 3000);

console 命令行工具 X clear

                    
>
console