Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

consistency is important