- 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.
推薦閱讀
- Python語言程序設計
- Building Minecraft Server Modifications
- Hands-On GPU:Accelerated Computer Vision with OpenCV and CUDA
- Web程序設計(第二版)
- Learning Hunk
- C語言程序設計同步訓練與上機指導(第三版)
- Mastering Linux Network Administration
- 領域驅動設計:軟件核心復雜性應對之道(修訂版)
- Vue.js 2 Web Development Projects
- Clean Code in C#
- Python機器學習算法與應用
- Getting Started with Polymer
- Java程序設計與項目案例教程
- Python開發(fā)基礎
- Python機器學習