Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript and the DOM (Retiring) Responding to User Interaction The Event Object

Alasdair Marchant
Alasdair Marchant
4,592 Points

What does => mean in the code?

dataset.addEventListener("click", (event) => { console.log(event.target.);

I don't quite understand what this part of the code means: =>

1 Answer

Johan Cederschiöld
Johan Cederschiöld
5,708 Points

Hi Alasdair, I agree it's a bit confusing :-) and I'm not sure if I understand your question correctly, but here goes. The => indicates that it's an arrow function (a more concise way to specify functions). It's explained in the course "Getting started with ES2015": https://teamtreehouse.com/library/getting-started-with-es2015-2

You can practice using it in this workshop: https://teamtreehouse.com/library/practice-arrow-functions-in-javascript

Hope it helps. /Johan