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: