Mike Cronin
1 min readAug 23, 2019

--

To get access to a Promise’s resolve value, you have to use a .then(), remember?

let goodOne = Promise.resolve("Hello there");
goodOne.resolved
// undefined
goodOne.then(function(result) {console.log(result + "!!")});
// LOG: Hello there!!
// just a reminder that we can pass anything into resolve()
let objExample = Promise.resolve({hi: "there"});
objExample.then(function(result) {console.log(result.hi)})
// LOG: there

See that then? Your resolve value is passed to whatever function you put into the .then() . Once you have it, you can use it as if it were a regular value.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response