Web APIs (navigator, geolocation, history)

What aspect of the History API is being demonstrated in Option 2?
const scrollOptions = {
  top: 1000,
  left: 0,
  behavior: 'smooth'
};

document.getElementById('scrollBtn').addEventListener('click', function() {
  // Option 1
  window.scrollTo(scrollOptions);
  
  // Option 2 - update history
  const scrollPosition = 1000;
  window.scrollTo(scrollOptions);
  history.pushState({scrollY: scrollPosition}, '', '#section-' + scrollPosition);
});

// Handle history navigation
window.addEventListener('popstate', function(event) {
  if (event.state && event.state.scrollY !== undefined) {
    window.scrollTo({
      top: event.state.scrollY,
      behavior: 'smooth'
    });
  }
});
Next Question (34/40)