Error Handling in Async Code

What is the purpose of this global error handler?
window.addEventListener('unhandledrejection', event => {
  console.error('Unhandled promise rejection:', event.reason);
  event.preventDefault();
  // Report to error tracking service
});
Next Question (4/20)