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 trialNick Miller
Full Stack JavaScript Techdegree Graduate 21,991 PointsWhat is the event listener supposed to look like on this?
I'm passing this quiz but I'm confused by why my answer didn't work here. The call back function I used as an event handler was () => handleChange() . Would that not work in producing the desired effect?
1 Answer
Nick Miller
Full Stack JavaScript Techdegree Graduate 21,991 PointsHi Oliver,
That's not working in the quiz. Here's the code with the event listener included:
select.addEventListener('change', ()=> handleChange);
I've also tried including the () after handleChange.
Here's the full code of the question on the quiz:
function handleChange() {
console.log('I was changed!');
}
select.addEventListener('change', //Fill in here);
Oliver Duran
Full Stack JavaScript Techdegree Graduate 22,828 PointsOliver Duran
Full Stack JavaScript Techdegree Graduate 22,828 PointsRemember: the function "handleChange" is already decleared on top, therefore you don't have to add an arrow function to de eventListener just call the one already decleared.