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 Uses for Closures

begin code for the 4th video downloaded does not match what is in the video

the code in my download looks like this:

var buttons = document.getElementsByTagName('button');

for(var i = 0; i < buttons.length; i += 1) {
    var button = buttons[i];
    var buttonName = button.innerHTML;
    button.addEventListener('click', function() {
        console.log(buttonName);
    });
}

file name is "setUpHandlers.js"

i opened the workspace... and it was identical code. Is is just me?

1 Answer

NVM.... i figured it out. THANKS!