JavaScript Three code annotation Methods _ Basics

Source: Internet
Author: User

There are three of annotation methods in JavaScript language.

The first is multiline annotation "/**/", the general JS file at the beginning of the introduction of the author, functions and other information.

Copy Code code as follows:
/*
*author:xxx
*day:2008-08-10
*/

The second annotation method is the most common "//", which can be seen all over the program, with only a single note.

Copy Code code as follows:
This is a one-line comment that can only comment a single line.
Another line of comments

The third annotation is not very common and is confusing with comments within HTML and is not recommended.

Copy Code code as follows:
<!-This is a line of comments and can only comment on a single line.

The third way is not to add, this is not the same place as the HTML annotation.

Summary: recommend the method of using the first multiline annotation, as for why? If you want to annotate 100 lines of code, as long as the beginning and end of the comment is good, you want to use the second, each line to add, the file is more than the number of bytes.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.