ES6 - Complete a Promise with resolve and reject

I am passing the reject portion of the parametor, however I’m failing at the resolve.
The instructions say:
Make the promise handle success and failure. If responseFromServer is true , call the resolve method to successfully complete the promise.

Which I guess I don’t understand how to get the correct condition statement for checking if it is true. Or what I’m supposed to write for the proper conditional statement.
If someone could please help me figure this out. e.g. point me to the write thing to read so I can figure out how to solve it myself.
I have read on MDN about Promise - JavaScript and several other articles and still can’t figure it out.

Thanks in advance.

const makeServerRequest = new Promise((resolve, reject) => {
  // responseFromServer represents a response from a server
  let responseFromServer;
    
  if(responseFromServer === true) {
    resolve("We got the data");
  } else {  
    reject("Data not received");
  }
});

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36

Challenge: ES6 - Complete a Promise with resolve and reject

Link to the challenge:

You have modified code outside of where the comments indicated to modify. Note that if(responseFromServer) already checks the truthiness of the value.

1 Like

Thanks @nhcarrigan for the help.
I got it now.

Thanks,
Shawn Wright