Reading Notes for JavaScript advanced programming (1): ecmascript Basics

Source: Internet
Author: User
2.1 syntax

Case-sensitive, weak variable type, line-and-tail semicolons are optional, comments are double-slashes, and parentheses indicateCodeBlock

2.2 Variables

Variables are declared using VAR. Naming rules for variables: the first character must be a letter, underline, or dollar sign; the remaining characters can be an underscore, dollar sign, or any letter or digit.

Variable naming rules:

camel Tag Method : lowercase letter. The following words start with an uppercase letter. For example, VAR m Y T est v alue = 0, m Y S econd T est v alue =" hi ";

Pascal Markup: The first letter is capitalized, And the next word starts with an uppercase letter. For example: VaRMYTESTVAlue = 0,MYSEcondTESTVAlue = "hi ";

Hungary type labeling: Append a lower-case letter (or lower-case letter sequence) to a variable named by the Pascal mark, indicating the type of the variable. For example, I represents an integer, and s represents a string, as shown below:

VaRImYTESTVAlue = 0,SmYSEcondTESTVAlue = "hi ";

The prefix used to define ecmascript variables using the Hungary type markup method is as follows:

Type: array Prefix: A Example: avalues

Type: Boolean Prefix: B example: bfound

Type: Floating Point Prefix: F example: fvalue

Type: function Prefix: FN example: fnmethod

Type: integer Prefix: I example: ivalue

Type: Object Prefix: O example: otype

Type: Regular Prefix: re example: repatten

Type: String Prefix: s example: svalue

Type: Variable Prefix: V example: vvalue

2.3 keywords

The ECMA-262 defines the Keyword:

Break case catch continue default Delete do else finally for function if in instanceof new return switch this throw try typeof var void while

2.4 Reserved Words

Reserved Words in ECMA-262 3rd edition:

Abstract Boolean byte char class const debugger double Enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile

2.5 Original Value and reference value

The original value is a simple data segment stored in the stack, that is, their values are directly stored in the access location of the variable.

Reference value is an object stored in heap. That is, the value stored in a variable is a pointer to the memory of the object.

 

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.