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 trialJenn Glas
9,475 PointsI don't understand why the console gets involved.
Why do we use the console at all?
//1. Capture the link event on a link to an image $("#imageGallery a").click(function(){ var href = $(this).attr("href"); console.log(href);
1 Answer
Steven Parker
231,269 PointsThe console can be a useful testing and/or teaching aid.
The console can be very handy for observing things happening in a program for debugging problems or teaching.
Here it is being used as a teaching aid to display the value that the previous line of code acquires from the DOM. As you suspected, this has no effect on functionality of the lightbox itself and only serves to convey an understanding of how it works.
Jenn Glas
9,475 PointsJenn Glas
9,475 PointsAh ok, so we can just use it to just see what's going on? Is it necessary to keep? Thank you!
Steven Parker
231,269 PointsSteven Parker
231,269 PointsAs I said, in this particular case it is purely a teaching aid. Removing it will not affect the functionality of the light box.
Brandon Moore
10,266 PointsBrandon Moore
10,266 PointsI personally took it as to make sure when we do the overlay the href is successfully having the clicked item passed on to it.