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!

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 Callback Functions in JavaScript Callbacks and the DOM Using the Same Callback on Multiple Elements

juami alcazar
juami alcazar
6,443 Points

just to make sure, the usage of event in the arrow function is just a parameter/argument right? or is it required

const blurHandler = event => { event.target.className = 'highlight'; }

1 Answer

Steven Parker
Steven Parker
224,811 Points

The identifier "event" is a parameter, but it's also necessary in this case because it is used in the handler code.

Arrow functions can also be written without a parameter by placing empty parentheses where the parameter would otherwise go.

const warn = () => { alert("Watch out!"); };