DEV Community

Discussion on: Understanding JavaScript Promises

Collapse
 
sunflower profile image
sunflowerseed

I usually don't see the part response.status >= 200 && response.status < 300 and if it is done, won't you need to check for 304 as well?

Usually I see the usage:

  fetch(' url ')
    .then(response => response.json())
    .then(data => { do something with data })
    .catch(err => console.log(err));