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

Event vs E (event.target)

Why does the code below not cause an error to be thrown in my console? The person used e and then used event. He should have written e.target.

1 Answer

chris robinson
chris robinson
2,818 Points

Well even though you did not provide code to follow up with your example I can still tell you that....

when it comes to event it can be written in a couple different ways such as e, eve, event , All three of them will still be the same which is why no error was given here

For example when you do the event target it could go e.target event.target common ways I always see it written

Also the way you saw it with it being different is valid but when one decides to use a certain way should be followed thru out the rest of the code

@chrisrobinson

invitedList.addEventListener("change", (e) => { const checkbox = event.target ; }) ;

here's the code