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 trialCasiey Lebron
3,187 PointsSingle line/Multi-line comments
In what instances can we use these comments, Can they replace out paragraphs, titles and text written on html pages?
2 Answers
Tommy Choe
38,156 PointsHey Casiey, comments can be used anytime you want to annotate or make a note in your code. Anything that is placed after/inside of the comments aren't read by the compiler. So they can "replace out" paragraphs, titles, and texts.
Hope that answers your question.
Casiey Lebron
3,187 PointsAwesome... thank you both!
LaVaughn Haynes
12,397 PointsLaVaughn Haynes
12,397 PointsTommy is correct. Another good use is when you think part of your code might be causing or will cause problems. You can use single or multi-line comments to comment it out for testing purposes. For example, if some value in my code depends on a complex function...
var answer = executeComplexFormula();
you comment out that line and set a specific value to test your code