禁用JavaScript中的行

bor*_*ris -6 javascript comments

在PHP中,我可以使用#//或禁用代码行/* disabled codes */.

我们如何在JS中做到这一点?

xil*_*il3 6

您可以使用///* lala */在JS为好.


Sha*_*ard 5

//之后将注释所有代码,直到下一个newline字符,示例:

//this whole line is commented. var x=5 has no effect because it's a comment
var x = 5; //x has been set as 5, comment is not whole line.
Run Code Online (Sandbox Code Playgroud)

/**/用于注释它们之间的所有内容,即使它跨越不止一行。例如:

/*
The following code will set x as 5
*/
var x = 5; /* yes it can also span only part of line */
Run Code Online (Sandbox Code Playgroud)

虽然与 PHP 不同,#JS 不用于注释代码,但它更像是 C/C++/Java 语言。