Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Meg Cusack11,448 Points
Quote marks outside of the H2 tags?
In the variable challenge, what is going on with his first line of code where he has quote marks outside of the H2 tags? He hasn't talked about that yet.
Aaron Loften8,303 Points
Fantastic question. It's a string that isnt assigned anywhere. Meaning, it's useless. He is using it like a comment to himself in the code that will not appear to the user. Honestly, I think he was wrong to do this.
The first line is a string. However, it is not assigned to a variable, not being used anywhere, and doesnt show up on the page. It also looks like an accident to a stranger.
Personally, I feel this is "bad practice." This means we shouldnt do things this way because they could cause errors in some scenarios or confusion.
A better way to have done this would be with a comment.
//this is a comment that counts as a note to the developer. var note = "Read the comment in the file, because the comment wont appear on the page to a user.";
Infact, when typing in the string he wrote, I recieved an error on my editor.
Though it shouldnt, in theory, hurt to write random strings everywhere, you should avoid it since it could cause disorganization and confusion in the code. :)
Good job asking questions like this. It helps to question things that dont look right.