我怎样才能在 JavaScript 中写评论,什么时候写?
How can I write comments in JavaScript and when?
如何在 JavaScript 中以及何时撰写评论?
如果你需要多行命令使用这个
/**
* This is my multiline command
*/
如果你想要内联命令,那么只需使用这个
// This is my inline command
要注释掉单行,可以使用//
示例
//This Button is for linking and demo
<Button>Click Me</Button>
另一种方式,您可以使用 /*
作为开始,使用 */
作为结束
示例
/*Describe my whole js file what am I doing
This js include three function which was...
also that...
finally...
*/
试试这个 article,你会更好地理解 JavaScript 条评论
这取决于你想写什么类型的评论:单行或多行。
对于单行,你可以试试这个:
//我是评论
对于多行:
/* 我是一个
多行注释 */
查看此 tutorial,了解更多信息。
如何在 JavaScript 中以及何时撰写评论?
如果你需要多行命令使用这个
/**
* This is my multiline command
*/
如果你想要内联命令,那么只需使用这个
// This is my inline command
要注释掉单行,可以使用//
示例
//This Button is for linking and demo
<Button>Click Me</Button>
另一种方式,您可以使用 /*
作为开始,使用 */
作为结束
示例
/*Describe my whole js file what am I doing
This js include three function which was...
also that...
finally...
*/
试试这个 article,你会更好地理解 JavaScript 条评论
这取决于你想写什么类型的评论:单行或多行。 对于单行,你可以试试这个:
//我是评论 对于多行: /* 我是一个 多行注释 */
查看此 tutorial,了解更多信息。