Home  >  Article  >  Web Front-end  >  What are the three ways to write comments in JavaScript?

What are the three ways to write comments in JavaScript?

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-04-08 11:50:468716browse

Three ways to write comments in JavaScript: 1. Use "/*comment code*/" to make multi-line comments; 2. Use "//comment code" to make single-line comments; 3. Use "< ;!-- Content to be commented", single line comments can be made.

The operating environment of this tutorial: Windows 7 system, JavaScript version 1.8.5, Dell G3 computer.

JavaSciprt comments will not be read by the browser and will be automatically skipped. Writing comments is important for you to go back and check quickly later. When writing comments, try to be concise and detailed. Let’s talk about the comments. The three basic methods
This is what I read in the book (mainly I have never seen the third method. In fact, the third method is easily confused with HTML, so there is no need).
1、/* Write what you want to comment here*/Multi-line comments

如:/* IT红海 */ 这里的内容就不会被显示

2、/ /Single line comment

// 不断学习

3, f49a254ba23c39d0f5796df9be59bacb after this method. This is different from html comments.

<!-- JS DOM 编程艺术

[Recommended learning: javascript video tutorial]

The above is the detailed content of What are the three ways to write comments in JavaScript?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn