- 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.
推薦閱讀
- 騰訊iOS測試實踐
- Learning Docker
- Learning Elixir
- Linux命令行與shell腳本編程大全(第4版)
- Android開發案例教程與項目實戰(在線實驗+在線自測)
- The Professional ScrumMaster’s Handbook
- Flowable流程引擎實戰
- Hands-On GUI Programming with C++ and Qt5
- Azure Serverless Computing Cookbook
- SQL Server 2016 從入門到實戰(視頻教學版)
- Python函數式編程(第2版)
- Delphi開發典型模塊大全(修訂版)
- Functional Python Programming
- Java多線程并發體系實戰(微課視頻版)
- 高性能MVVM框架的設計與實現:San