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 DOM Scripting By Example Adding and Removing Names RSVP Checkbox

consistency between (e)=> {} and event.

The teacher first used

ul.addEventListener('change',(e)=>{
  console.log(e.target.checked);
})```
to log out the information then he used 
```ul.addEventListener('change',(e)=>{
  const checkbox = event.target;
  const checked = checkbox.checked;
  const listItem = checkbox.parentNode.parentNode;
  if (checked) {
    listItem.className = 'responded'
  } else {
    listItem.className = ''
  }})

I mean why don't he try to make it consistent by using

``` const checkbox = e.target;

or 
```ul.addEventListener('change',(event)=>{```

2 Answers

Steven Parker
Steven Parker
231,275 Points

I'd guess it was unintentional. It might even qualify as a "bug" in the course. If you consider it so, you may want to report it to the staff as described on the Support page.

It probably didn't get noticed because many browsers establish a global "event" variable which is equal to the event object of the current event.

lee ellis
lee ellis
8,430 Points

Mixing these didnt work in my browser, i had to change this to match otherwise no styling would show around the checkbox (using firefox).

the same here, tested on firefox 59.0.2 (64-bit) had to change to 'const checkbox = e.target;' Otherwise I get a reference error: "ReferenceError: event is not defined"