Chrome Extension

Javascript Async/Await ES7

async function foo() {
    const myPromise = new Promise((resolve, reject) => {
        setTimeout(() => {
            resolve("Parwinder"); // resolves with "Parwinder" after 2 seconds
        }, 2000);
    });

    // will not move to the next line until myPromise resolves/rejects
    const name = await myPromise;
    // the execution pauses (or awaits) for the promise

    console.log(name); // Parwinder
}

foo();
We are a bunch of lazy programmers so we developed this chrome extension
search code from your favorite search engine
Install Now

Javascript Async/Await ES7 

Async/Await was introduced in ES7 to promote a cleaner syntax to promises. Under the hood, async/await are promises; they provide a nice abstraction layer under those keywords.

Search Index Data (The code snippet can also be found with below search text)

Javascript Async/Await ES7
Was this helpful?
0 Comments
Open Code Manager We are hiring