Handle a Fulfilled Promise with then challenge

Hi guys,why do i get error when i console.log outside my code on this challenge??

  **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");
} else {  
  reject("Data not received");
}
});

makeServerRequest.then(result => {

});
console.log(result)

  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:96.0) Gecko/20100101 Firefox/96.0

Challenge: Handle a Fulfilled Promise with then

Link to the challenge:

Because result is not defined outside the function that you have in then.

1 Like

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