Add a click listener to a button
Company: The Trade Desk
Role: Software Engineer
Category: Other / Miscellaneous
Difficulty: easy
Interview Round: Technical Screen
Given an HTML page that includes a button with the id 'my-button', write JavaScript to add a click event listener so that when the button is clicked, the button's text content is logged to the console. Use document.querySelector and addEventListener. Briefly explain what e.target refers to in this context.
Quick Answer: This question evaluates understanding of DOM event handling and the event object in JavaScript, including use of document.querySelector, addEventListener, and the meaning of e.target.