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


Alexandros S.
Alexandros S.
8,261 Points

Code still works after commenting it out.

So I tried out some code from a question in a quiz from the "JavaScript Basics" because I didnt understand it very well.

// name = "Trish";
function setName() {
  var name = "Sarah";


When I ran the code in my browser an alert opened saying "Trish". But how is that possible when " // name = "Trish"; " is commented out?!

1 Answer

Codin - Codesmite
Codin - Codesmite
8,600 Points


Seems to work correctly for me, removing the comments outputs Trish in the alert box and adding them back removes Trish.

Check the files on your server are correct and try clearing your browser cache, as it may be loading the page or variable from cache.


Alexandros S.
Alexandros S.
8,261 Points

Thanks, it worked properly after clearing chrome's cache and restarting it.