ES6 - Handle a Fulfilled Promise with then

Tell us what’s happening:
I’m not sure what function to define with result

Your code so far

const makeServerRequest = new Promise((resolve, reject) => {
  // responseFromServer is set to true to represent a successful response from a server
  let responseFromServer = true;
    
  if(responseFromServer) {
    resolve("We got the data");
    responseFromServer.then(result => {
    });
  } else {  
    reject("Data not received");
  }
});
console.log(result)

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36

Challenge: ES6 - Handle a Fulfilled Promise with then

Link to the challenge:

Then why is it asking me to log the result?

Yeah I’ve done that but the instructions also say that I should log the result to the console and when I do that it says that result is not defined

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.