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


Eng Seng Heah
Eng Seng Heah
17,106 Points

Why do we need a const referral ?

The click event works fine even without defining const, what is it for?

Amrit Pandey
Amrit Pandey
17,595 Points

I am not sure what is meant by const referral. But if you are saying that click handling function is treated as a constant then yeah, it is to make sure that handling function is not altered in anyway.

1 Answer

Steven Parker
Steven Parker
229,607 Points

Are you implicitly creating a global?

If you mean you leave off "const" where a variable is created, that causes the variable to be created as a global instead of a local constant. The code might work, but it's considered bad practice. And if you were running in "strict" mode it would cause an error and not be allowed at all.