Home>Article>Web Front-end> How to comment in a single line in javascript

How to comment in a single line in javascript

藏色散人
藏色散人 Original
2021-07-13 11:42:39 3475browse

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.

How to comment in a single line in 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!

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