SOURCE

// console.log(['00','01', '02', '03'].map(Number))
// setTimeout 方法
// function sleep(callback, time) {
//     if(typeof callback === 'function') {
//         setTimeout(callback,time)
//     }
// }
// function dev () {
//     console.log('ljc')
// }
// sleep(dev, 2000)

// Promise
const resolveAfter2Seconds = time => {
  return new Promise(resolve => {
    setTimeout(() => {
      resolve('intimacy');
    }, time);
  });
}

async function asyncCall(time) {
  console.log('calling');
  const result = await resolveAfter2Seconds(time);
  console.log(result);
  // expected output: "resolved"
}

asyncCall(2000);


console 命令行工具 X clear

                    
>
console