- Object-Oriented JavaScript(Second Edition)
- Stoyan Stefanov Kumar Chetan Sharma
- 163字
- 2021-08-13 16:19:30
Comments
One last thing for this chapter: comments. Inside your JavaScript program, you can put comments. These are ignored by the JavaScript engine and don't have any effect on how the program works. But, they can be invaluable when you revisit your code after a few months, or transfer the code to someone else for maintenance.
Two types of comments are allowed:
- Single line comments start with
//
and end at the end of the line. - Multiline comments start with
/*
and end with*/
on the same line or any subsequent line. Note that any code in between the comment start and the comment end is ignored.
Some examples are as follows:
// beginning of line var a = 1; // anywhere on the line /* multi-line comment on a single line */ /* comment that spans several lines */
There are even utilities, such as JSDoc and YUIDoc, that can parse your code and extract meaningful documentation based on your comments.
推薦閱讀
- Oracle WebLogic Server 12c:First Look
- Reporting with Visual Studio and Crystal Reports
- Rake Task Management Essentials
- Java:Data Science Made Easy
- Python數據分析(第2版)
- TradeStation交易應用實踐:量化方法構建贏家策略(原書第2版)
- The DevOps 2.5 Toolkit
- 鴻蒙OS應用編程實戰
- MySQL程序員面試筆試寶典
- Groovy 2 Cookbook
- Instant GLEW
- 和孩子一起學編程:用Scratch玩Minecraft我的世界
- Java 7 Concurrency Cookbook
- 每個人的Python:數學、算法和游戲編程訓練營
- HTML5程序開發范例寶典