Why is it that when I enter ‘=== true’ in my if statement the code does not pass?
Describe your issue in detail here.
The concept of the promise is not what I do not understand. I am more so curious as to why my code did not pass when I entered
“if (responseFromServer === true)”
vs
"if(responseFromServer)
why is it that the code did not pass when I completed the boolean vs letting the default value be implied??
thanks in advance
Your code so far
const makeServerRequest = new Promise((resolve, reject) => {
// responseFromServer represents a response from a server
let responseFromServer;
if(responseFromServer === true) {
resolve("We got the data");
// Change this line
} else {
reject("Data not received");
// Change this line
}
});
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36
Challenge: ES6 - Complete a Promise with resolve and reject
Link to the challenge: