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 trialZhenghao He
Courses Plus Student 2,389 Pointsconsistency between (e)=> {} and event.
The teacher first used
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
231,269 PointsI'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
8,430 PointsMixing these didnt work in my browser, i had to change this to match otherwise no styling would show around the checkbox (using firefox).
Bozhong Tao
18,365 Pointsthe 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"
Zhenghao He
Courses Plus Student 2,389 PointsZhenghao He
Courses Plus Student 2,389 Pointsthanks Steven. Can you please take a look at this question as well https://teamtreehouse.com/community/how-do-i-achieve-button-smooth-background-transition-on-mobile-device