The JavaScript authoritative guide learning note--day2

Source: Internet
Author: User

Holiday, put their day off, played a day of the game, also counted as complete. Continue studying today. I do not know how many good programmers still have to go, every day step by step, one day you can complete their wishes and ideals.

4th Chapter Expressions and operators

4.1 Original expression

The original expression in 1.JavaScript contains constants (direct amounts), keywords, and variables.

1.23//Digital Direct volume

True//keyword

I//return value of variable i

4.2 Initialization expressions for arrays and objects

1. Arrays and object expressions can be nested, such as a=[[1,2],[3,4],[5,6]].

2. Spaces between commas in the array are populated with undefined, such as a=[1,,, 5]. a[1]=undefined.

4.3 Function expressions

4.4 Property-Access expressions

4.5 Calling an expression

1. When the invocation expression evaluates, the function expression is evaluated first, and the parameter expression is evaluated.

2. If you give a return value using the return statement, this value is the value of the entire invocation expression.

4.6 Object-Creation expressions

1. The object creation expression is similar to a function call expression, except that it faces a new, such as var a = new object ();

2. If an object creation expression does not need to pass in parameters, then the trailing spaces can be omitted.

4.7 Overview of Operators

4.8 Arithmetic expressions

4.9 Relational expressions

The 1.instanceof operator expects the left operand to be an object, and the right operand is the class that identifies the object. Example: a instanceof Object.

2. All objects are instances of object. When a instanceof is judged by whether an object belongs to an instance of a class, this judgment also includes detection of the "parent class".

3. To understand how instanceof works, first understand what a "prototype chain" is.

Example: In order to calculate a instanceof f,javascript first calculate the F.prototype, then find a in the prototype chain. Returns True if a is found to be an instance of f (or the parent class F), otherwise false is returned.

4.10 Logical Expressions

1.&& is sometimes referred to as a "short circuit". In general, the expression on the right side of,&& has side effects (assignment, increment, decrement, function call expression) with extra care.

4.11 Assignment Expressions

4.12 Expression Calculation

5th Chapter Statement

1.JavaScript can combine multiple statements together to form a compound statement. Just enclose them in curly braces.

{

x = Math.PI;

CX = Math.Cos (x);

Console.log ("cos (π) =" + cx)

}

Variables declared by 2.var cannot be deleted by delete.

3. Conditional statements include if and switch.

4. Loop statements include while, do while, for, for/in

The content of these two chapters is not difficult, more easy to understand, mainly the memory of some knowledge points. Tomorrow will continue to learn the 6th and 7th chapters of the array.

The JavaScript authoritative guide learning note--day2

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.