JavaScript series (i) syntax, key reserved words, variables

Source: Internet
Author: User

ECMA is the abbreviation for European Computer Manufacturers Association, the European Association of Computer manufacturers. The European Association of Computer manufacturers is an international standard organization for the development of information transmission and communication.

ECMAScript is a standardized scripting language developed by ECMA.

The ECMAScript version currently used by JavaScript is ECMAScript-262.



First, use JavaScript

In the HTML or XML header

<script type= "Text/javascript" src= "Demo1.js" ></script>


Second, the grammar

1, case-sensitive: including variables, function names and operators.

2, identifier: refers to the variable, function, the name of the property, or the parameters of the function.

Note: The first character must be a letter, cannot use keywords, reserved words. such as: mybook11

3. Comments:

ECMAScript uses C-style annotations, including single-line comments and block-level annotations.

Single-line Comment

/*

* This is a multi-line

* Notes

*/

4, the amount of literal or face:

All direct quantities (literals) are the data values that are displayed directly in the program.

100//Digital literal

' Li Shiming '//string literal

False//Boolean literal

/js/gi//Regular expression literals

Null//Object literal

In ECMAScript version 3rd, expressions like array literals and object literals are also supported, as follows:

{x:1, Y:2}//object literal expression

[1,2,3,4,5]//array literal expression


Iii. keywords and reserved words

JS-specific keywords, typically used to control the start or end of a statement, or to perform a specific operation. Keyword is also language reserved and cannot be used as an identifier

ECMAScript All Keywords

Break Else new Var

Case finally return void

Catch for switch while

Continue function this with

Default if throw delete

In Try do instanceof

typeof


Iv. variables

The ECMAScript variable is loosely typed, and the so-called loose type is used to hold any type of data. Use the var operator when defining variables (Var is the key), followed by a variable name (the variable name is an identifier).

var box;

alert (box);

The variable is not assigned a value, and the system gives it a special value-undefined (undefined)





This article is from the "Linux Warden" blog, so be sure to keep this source http://sswqzx.blog.51cto.com/2494644/1966003

JavaScript series (i) syntax, key reserved words, variables

Related Article

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.