JS Basic syntax

Source: Internet
Author: User

1. Syntax

JavaScript syntax is similar to the Java language, with each statement being; End, statement block with {...}. However, JavaScript does not enforce the requirement to add at the end of each statement; , the engine responsible for executing JavaScript code in the browser automatically complements the end of each statement.

(a line typically writes a statement and does not recommend writing multiple statements on one line).

2. Notes

Comments are for developers to see, and the JavaScript engine is automatically ignored.

(1). Characters that start with//until the end of the line are treated as line comments. This is a line of note alert ("Hello World"); This is also a comment

(2). Another block comment is to wrap a multiline character with/*...*/and treat a chunk as a comment. /* Starting from here is the block comment is still the comment comment end */

3. Identifiers

Identifiers are names that are assigned to variables, functions, and objects.
The letter that makes up the identifier is a specification of the naming rules for identifiers in the JavaScript language:

1. Case-sensitive

2. The first character of an identifier can be an underscore _, a dollar symbol, or a letter, but not a number; Other characters can be an underscore _, dollar symbol $, letter or number

3. Identifiers cannot use keywords and reserved words, etc.

JS Basic syntax

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.