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 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