- Object/Oriented JavaScript
- Stoyan Stefanov
- 161字
- 2021-08-13 19:25:53
Comments
One last thing for this chapter: comments. Inside your JavaScript code 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 - Multi-line 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 will be ignored.
Some examples:
// 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, that can parse your code and extract meaningful documentation based on your comments.
推薦閱讀
- 持續演進的Cloud Native:云原生架構下微服務最佳實踐
- 擁抱開源(第2版)
- AutoCAD快速自學寶典(2018中文版)
- 數字孿生體:第四次工業革命的通用目的技術
- Dreamweaver CC實例教程(第5版·微課版)
- 中文版Photoshop 2020基礎教程
- Elasticsearch實戰與原理解析
- Java EE 6 with GlassFish 3 Application Server
- Flash CC動畫制作與應用(第3版)
- Unity 3 Game Development Hotshot
- 零基礎學Procreate萌物繪
- CorelDRAW 2018平面設計基礎教程(第3版)
- R語言科研繪圖與學術圖表繪制從入門到精通
- NetBeans IDE 7 Cookbook
- Adobe Captivate 7 for Mobile Learning