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 trialMichael Stedman
Full Stack JavaScript Techdegree Student 13,838 PointsViewing single line comments and multi-line comments in the console of Chrome's Developer Tools and Console?
So, I just started the Conditional Challenge and I put some multi-line comments and a single line comment at the very beginning. I am using them just for practice, as well as having the challenge instructions and the questions and answers that I will have in the program.
I also initiated a random variable to be called by the console just so that I could practice and see if that was working so far (breaking things down and testing every thing in small chunks). When I went to the console, none of the comments that I included in the code appeared in the console.
I was wondering if there is a way for single line and multi-line comments were able to be viewed in the console, or even anywhere in the Developer Tools part of Chrome at all. I know that I can see the whole .js file by:
- Right clicking on the browser being previewed.
- View Page Source
- In the the code for the index.html file, click on the
src
for the .js that is embedded in the HTML file.
That shows the comments, but was curious about console or some other place in the DevTools for Chrome specifically. Below is a snippet of my code just in case anyone asks. And the variable and console.log();
does work in my console.
/* THE CONDITIONAL CHALLENGE INSTRUCTIONS
1. Ask at least five questions.
2. Keep track of the number of questions the user answered correctly.
3. Provide a final message after the quiz letting the user know the number of questions he or she got right.
4. Rank the player. If the player answered all five correctly, give that player the gold crown, 3-4 is a silver crown, 1-2 is a bronze crown, and 0 correct is no crown at all.
*/
/* CHALLENGE QUESTIONS AND ANSWERS
1.
2.
3.
4.
5.
*/
// Testing the console
var testConsole = 'Hello, console.';
console.log(testConsole);
1 Answer
Steven Parker
231,275 PointsComments can be viewed in the Sources panel.
To my knowledge, that's the only place you will see them (or the functioning JavaScript code) in the developer tools. The Console tab would only show error code or items explicitly logged.