Home>Article>Web Front-end> How to comment in a single line in javascript
In JavaScript, a single-line comment is represented by double forward slashes "//", which can be used before and after a statement. Its syntax is such as "//This is a single-line comment", which means "//" All characters after the symbol until the end of the line will be ignored by JavaScript.
The operating environment of this article: Windows 7 system, javascript1.8.5, Dell G3 computer.
How to comment in a single line in javascript?
Single-line comments
In JavaScript, single-line comments are represented by double forward slashes (//) and can be used before and after a statement.
Syntax:
// 你的代码在这里
All characters following the // syntax until the end of the line will be ignored by javascript.
Example 1: Add
before the statement Example 2: Add
after the statement Related video tutorial sharing:javascript advanced video
The above is the detailed content of How to comment in a single line in javascript. For more information, please follow other related articles on the PHP Chinese website!