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
// undefinedgoodOne.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.