Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript and the DOM (Retiring) Responding to User Interaction Listening for Events with addEventListener()

In "addEventListener('mouseover', (), why are the parentheses empty before the arrow function?

Sorry in advance if this is a ridiculous question but I've understood everything up until now. I did the practice on arrow functions and I thought I understood them but I guess I am struggling to apply their use to methods, particularly the addEventListener method. So what are the first empty set of () supposed to mean? Is this what Guil was referring to as an anonymous function? Thanks in advance.

2 Answers

Steven Parker
Steven Parker
231,268 Points

The empty parentheses indicate that the function takes no argument(s), and are required by the syntax.

Arrow function expressions are also anonymous, whether they take arguments or not. That just means they don't have a specific name.

This made more sense once I re-watched the video about events. Thank you.