JavaScript JavaScript and the DOM 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,706 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