JavascriptEvents

Events represent user interactions or browser actions like clicks, typing, or loading a page. JavaScript responds to events by attaching event listeners to elements, running functions when events occur. This interactivity makes websites dynamic and user-friendly.

button.addEventListener('click', function() {
  alert('Button clicked!');
});