Whats going on why isnt the code working?

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

  **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 = false;
  
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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Safari/605.1.15.

Challenge: Handle a Fulfilled Promise with then

Link to the challenge:

:grey_question:

I entered the code exactly like I did before and it got rejected?

What do the failing tests say? Your solution appears to work.

I don’t know! Something about “invalid syntax”.

There is a bug right now regarding Safari support. Until it’s resolved, you can use Firefox, Chrome, or Edge.

2 Likes

I also tested your code and it passes for me.

I am using chrome and it works

Bet! Thanks a lot for this info.

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