What is the JavaScript multiline comment symbol?

青灯夜游
Release: 2021-11-05 14:01:10
Original
5836 people have browsed it

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:

/* 注释内容 */
Copy after login

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>
Copy after login

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
*/
Copy after login

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>
Copy after login
[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!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!