Notes on Javascript Basics Tutorial
The purpose of comments is to improve the readability of the code and help yourself and others read and understand the JavaScript code you write. The content of the comments will not be displayed on the web page. Comments can be divided into two types: single-line comments and multi-line comments.
In order to facilitate reading, the comment content is generally placed at the end of or around the statement that needs to be explained.
Single-line comment: //
Please see the following example:
javascript
We only commented one output hello, and we have a comment afterwards to write this sentence It means that it will not be displayed on the page when we run it, but it will be easier for others to understand when they look at your source code
Multi-line comments: /*Comment content */
Let’s look at an example below, so that we can comment out the first two lines so that they will not be executed
javascript
Note: As in the above case, when we need to comment out the previous When writing 2 sentences, you can also use the shortcut key ctrl+question mark key. The premise is that the content we want to comment must be selected first