官术网_书友最值得收藏!

Commenting code

It is best practice to always document your JavaScript code through the use of comments. At a minimum, this should include the author of the code, date of last revision, and the general purpose of the code. In addition, at various points throughout your code you should include comment sections that define the purpose of specific sections of the application. The purpose of this documentation is to make it easier for you or another programmer to quickly get up to speed in the event that the code needs to be updated in some way.

Any comments that you include in your code are not executed. They are simply ignored by the JavaScript interpreter. JavaScript can be commented in a couple of ways including single line and multi-line comments. Single line comments start with // and any additional characters you add to the line. The following code example shows how single line comments are created:

//this is a single line comment.  This line will not be executed

Multi-line comments in JavaScript start with /* and end with */. Any lines in between are treated as comments and are not executed. The following code example shows an example of multi-line comments (also called block comments):

/* 
Copyright 2012 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 
*/ 
主站蜘蛛池模板: 濮阳县| 邢台县| 蓝田县| 沙雅县| 尚志市| 河北省| 万安县| 米脂县| 铜山县| 筠连县| 军事| 榆社县| 泗洪县| 乐昌市| 个旧市| 曲沃县| 德清县| 齐齐哈尔市| 德江县| 买车| 库车县| 日土县| 富蕴县| 南开区| 都兰县| 鄂尔多斯市| 上高县| 高陵县| 宜君县| 内江市| 合川市| 天水市| 论坛| 英德市| 罗田县| 铜川市| 拉孜县| 临桂县| 阿鲁科尔沁旗| 安远县| 玉门市|