Promise function resolve reject error

Tell us what’s happening:
Describe your issue in detail here.

I’ve completed the code, written the if else statement. Still I get an error saying ‘reject should be called with the expected string when the if condition is false.’
Your code so far


const makeServerRequest = new Promise((resolve, reject) => {
// responseFromServer represents a response from a server
let responseFromServer;
  
if(responseFromServer) {
  // Change this line
  resolve("We got the data");
} else {  
  // Change this line
  reject("Data not recieved");
}
});
  **Your browser information:**

User Agent is: Mozilla/5.0 (Linux; Android 9; Redmi Note 8 Pro) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.101 Mobile Safari/537.36

Challenge: Complete a Promise with resolve and reject

Link to the challenge:

There is a spelling error in the word received.
If you fix that the test should pass.

1 Like

Thnq. I’ve got it passed.

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