ES6 - Handle a Fulfilled Promise with then

Tell us what’s happening:
Describe your issue in detail here.
Hello everyone
the exercise wanted me to console.log the result I know there is something wrong with my code, but I couldn’t figure it out and the hint of the exercise doesn’t give any information except for the solution, any tiny hint will be highly appreciated.

  **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 ;
  
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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.81 Safari/537.36 Edg/104.0.1293.54

Challenge: ES6 - Handle a Fulfilled Promise with then

Link to the challenge:

What’s the scope of result? Where does it exist?

1 Like

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