This lesson, we're going to be focused on comments before we get into variables, and there's going
to be a brief introduction of variables in this lesson because they are so important.
So within JavaScript, we use comments and this is typically used by coders in order to provide information
about what's happening within the code and documentation of what's happening within the code.
So this is also ignored within the browser.
So it's not meant for the webpage viewer, it's meant for the developer.
And so always good practice to comment information.
And of course, when you come back to it, you're always going to be thankful that you've made those
comments.
When you come back to your code after a few months or a few years, you can always pick up on where
you left off white spaces ignored in JavaScript so you can type white space.
And the reason for adding in white space again is to make it more readable.
So the challenge for this lesson is to add comments and you can go ahead and create a variable, as
we saw before, using a variable name of a and giving value to that variable within the quotes.
And you can console log that out and then also add in some comments.
There's some code snippet here where we can see comments being used.
So as you can see, the comments are within the same statement line.
So all they do is they appear with the two Ford slashes and then this information that's presented within
the comment.
This isn't seen within the application.
So this is just for developers.
And then there's also multiline comments.
So try out both try out the single line comments, create a variable, give it a value, and then you
can add in a comment there and then console log that out.
And then you can also have a comment that's multiple lines indicated with the Fortgang strikes and then
the Asterix the forward again to close off that comment.
So positivity, try that out and I'll show you the solution.
You can use the same JS file that we created in the earlier lesson.
If you don't have one, then just go ahead and create one.
Link it from your indexed HTML file and then load the index file within your browser in order to see
the content being rendered out.
So in this case, we want to set up a variable.
You can use A or you can use another value in order to name the variable.
And there's, of course, more on this in the upcoming lesson.
And then you can type our message within the quotes and then console log out that value so you can see
when you refresh it that you've got Hello World and then documented by adding in some comments within
brackets, the comments are going to get grayed out.
So this was the test.
And then also you do a multi line comment.
So the forward and abstracts and you can add in whatever information you want here.
And when you come back to this file in a few years, then you'll be able to see that why you've added
in that variable, perhaps.
And there's also kind of where you are thinking and maybe what you need it to still do within the application,
within the multiline comment.
So try that out.