Home  >  Article  >  Web Front-end  >  What is the JavaScript multiline comment symbol?

What is the JavaScript multiline comment symbol?

青灯夜游
青灯夜游Original
2021-11-05 13:39:025791browse

In JavaScript, the multi-line comment symbol is "/* */", and the syntax is "/* comment content */". All content appearing between "/*" and "*/" will Content regarded as comments will be automatically ignored during execution.

What is the JavaScript multiline comment symbol?

The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.

In JavaScript, the multi-line comment symbol is "/* */"; multi-line comments start with /* and end with */end.

Syntax:

/* 注释内容 */

Any content appearing between /* and */ will be regarded as the content of the comment and is included in # Any characters between the ##/* and */ symbols are treated as comment text and ignored.

<!DOCTYPE html>
<html>
<head>
    <title>JavaScript</title>
</head>
<body>
    <div id="demo"></div>
    <script>
        /*
        在 id 属性为 demo 的标签中
        添加指定内容
        */
        document.getElementById("demo").innerHTML = "http://c.biancheng.net/js/";
    </script>
</body>
</html>

Multi-line comments generally begin at the beginning of a js file and introduce author, function and other information.

/*
*author:xxx
*day:2008-08-10
*/

In addition to using comments to add explanations or descriptions to the code, when debugging the code, we can also comment out the code that does not need to be run, so that the browser will ignore the comments when running the program. code. As shown in the following example:

    <script>
        document.getElementById("demo").innerHTML = "JavaScript教程";
        // document.getElementById("demo").innerHTML = "JavaScript";
        /*
            document.getElementById("demo").innerHTML = "注释";
            document.getElementById("demo").innerHTML = "JavaScript注释";
         */
    </script>

[Recommended learning:

javascript advanced tutorial]

The above is the detailed content of What is the JavaScript multiline comment symbol?. 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