const db = {
    name: Promise.resolve('jack'),
    addr: Promise.resolve('tapuia 72'),
    fav: Promise.resolve('kaisen')
};

async function profile() {
    let n = await db.name;
    let a = await db.addr;
    let f = await db.fav;

    return {n, a, f};
}

profile().then(res => console.log(res));

You'll note that profile() returned a Promise. An async function always returns a Promise, though as we see here, the function itself can return anything it would like.

results matching ""

    No results matching ""