Home>Article>Web Front-end> What does double diagonal bar mean in JavaScript?
In JavaScript, the double slash "//" represents a single-line comment. All characters in the line after the "//" character will be regarded as single-line comment information. The syntax format is "//single-line comment information" . When using single-line comments, any characters or codes in the same line after "//" will be ignored and will not be parsed.
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
In JavaScript, the double slash "//
" represents a single-line comment.
#Comments in JavaScript (single-line comments and multi-line comments)
Comments are a string of characters that are not parsed. JavaScript comments have the following two methods:
Single-line comments://Single-line comment information
.
Multi-line comments:/*Multi-line comment information*/
.
Example 1
Treats all characters in one line after the//
characters as single-line comment information. The following comment statements can be located at different locations in the code segment to describe the functions of different areas of code.
//程序描述 function toStr(a){ //块描述 //代码段描述 return a.toString(); //语句描述 }
When using a single-line comment, any characters or codes in the same line following//
will be ignored and will not Analyze again.
Example 2
Use/*
and*/
to define multi-line comment information.
/* * jQuery JavaScript Library v3.3.1 * https://jquery.com/ * Includes Sizzle.js * https://sizzlejs.com/ * Copyright JS Foundation and other contributors * Released under the MIT license * https://jquery.org/license * Date: 2019-08-21 T 17:24 Z */
in a multi-line comment, contained between/*
and*/ Any characters between the
symbols are treated as comment text and ignored.
For more programming related knowledge, please visit:Programming Video! !
The above is the detailed content of What does double diagonal bar mean in JavaScript?. For more information, please follow other related articles on the PHP Chinese website!