JS Authoritative Guide---study notes 02

Source: Internet
Author: User

1, JS only function scope, there is no block-level scope of the concept;

It has a feature-declaration in advance: variables declared in different positions in the same function are declared at the beginning of the function, and the assignment is performed at the original location;

2, the Declaration of global variables, equivalent to define a global object of a property;

1) If you declare a global variable using VAR, this property is not configurable. Which means you can't delete.

2) If you do not use the Var declaration, you can delete;

Example: var S1 = "S1"; Non-configurable global variables

S2 = "S2"; Configurable global variables

Delete S2; The delete operation can be performed and the variable will be deleted

3. ★ Scope Chain

4. Original expression: the smallest unit of an expression.

Contains: constants, direct quantities, keywords, variables;

PS: The direct amount is the constant value in the program that appears directly. 1.23 Digital Direct Volume "Hello" string Direct amount

5, the difference between keywords and reserved words: The keyword is JS has been used, has a certain meaning character. A reserved word is a reserved keyword that may not be a keyword now, and may become a keyword later.

6. Object and array initialization expressions are actually creating a new object or arrays. Also known as: Object direct amount, array direct amount, however they are not original expression.

7, array initialization, if there is no value in the middle, can be omitted directly;

var myArray = [,,, 3]; Two values are omitted in the middle and are automatically populated with undefined

var myArray = [1, 2,]; If the end ends with a comma, the undefined will not be populated

8, function definition expression: Also called function direct quantity;

var myFunc = function (x) {return x*x;} The function is to return the square of a number

9. Property access expression: Gets the value of an object property or an array element.

Directly using "point" or [] to get the value

Note: The attribute name cannot be a reserved word, a keyword, a space, or a punctuation mark when accessed with a "point";

10. Call expression: A representation of the calling function or method. such as: alert (' Hello ')

-If the called function returns a value using return, then this value is the value of the entire invocation expression. Otherwise, it's undefined.

JS Authoritative Guide---study notes 02

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.