📜  nodejs 并行异步调用 -1 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:12.198000             🧑  作者: Mango

代码示例1
async function sleep(time = 1) {
    const sleepMilliseconds = time * 1000
    
    return new Promise(resolve => {
        setTimeout(() => {
            resolve(`Slept for: ${sleepMilliseconds}ms`)
        }, sleepMilliseconds)
    })
}