Answers for "wrap wreck request inside async block"

0

wrap wreck request inside async block

const asyncOperation = () => {
    return new Promise((resolve, reject) => {
        setTimeout(()=>{resolve("hi")}, 3000)
    })
}

const asyncFunction = async (callback) => {
    let res = await asyncOperation();
    callback(res);
}

const topDog = () => {
    let callback = (res) => {
        console.log(res);
    };

    (async () => {
        await asyncFunction(callback)
    })()
}
Posted by: Guest on January-11-2021

Code answers related to "wrap wreck request inside async block"

Code answers related to "Javascript"

Browse Popular Code Answers by Language