Modern fetch API returns promises, simpler syntax. XHR has progress events.
Solution Code
JavaScript
fetch(url)
.then(res => res.json())
.catch(console.error);
Explanation
Fetch doesn't reject on HTTP errors. Requires manual handling of non-2xx responses.Guided Hints
AbortController usage
Polyfill for older browsers