<button>Click me!</button>
body {
	padding:2em;
	font-size:2em;
}
View Compiled
// Get a reference to the <button>
const btn = document.querySelector('button');

// Define object with `handleEvent` function
const myObject = {
  handleEvent: (event) => {
    alert(event.type);
  }
}

// Listen for 'click' events on the <button> and handle them with `myObject`... WHAT?!?!
btn.addEventListener('click', myObject);

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.