How to get resolved data from a Promise

Viewed 8612

Consider the following code snippet:

let primise = new Promise((resolve, reject) => {
    resolve({ x: 10 });
});

setTimeout(() => {
  // At some moment in the future (Promise is resolved)
    console.log(promise);
}, 200);

Now, the promise was resolved with { x: 10 }. How do I access this data using the resolved promise ?

Inspecting the promise object I can see the data is available as promise._v but this doesn't look right. Any help would be appreciated

2 Answers
Related