One, data type

Keep in mind two categories of 6 small classes:

Fi & t basic data type ( simple data type ): Undefined, null, number, string, boolean;

Second class complex data type ( reference data type ): Object; ( a person unde & tanding that its value is a memory address, for example:" 0x00000000 " But because of this address, you can refer to the data stored in this address.

All types can be used with typeof Operator To operate, it's important to note that typeof null = object

Typeof has a"function"value, so it isn't with the number type;

1, undefined type

Only remember: the variable value of the variable declared but not assigned is undefined; the value of the declared variable is undefined, but the former doesn't error. The latter is wrong.

2, null type
If the defined variable is used in the future to save the object, it's better to use null when initializing; Alert ( null = = undefined )//true alert ( null = = = undefined )//false
3, boolean type
Remember that other types of values have boolean ( ) methods converted to boolean values, either true or false, and are in particular to 0 and nan are false;

4, number type

Remember 4 methods, number ( ), parseint ( ), parseFloat ( ), isnan ( ); A common problem with ieee754 numeric float, some floating point numbers can't be precise, such as 0.1 +0.2! = 0.3

It's important to note that:

Number ( 123abc )//nan

Parseint ( 123abc )//123

5, string type

( 1 ) note the character literal:

The meaning of xnn is a string represented in hexadecimal code nn;

The meaning of unnnn is a unicode character represented in hexadecimal code

Follow up the es6 for this part of the content;

( 2 ) null and undefined don't have the tostring ( ) method, but there's a string ( ) method;

6, object type

This chapter doesn't have a thorough explanation of the methods and properties that are saved by the I & tance it creates, as follows:

( 1 ) construction

( 2 ) hasOwnProperty ( propertyname )

( 3 ) isPrototypeOf ( object )

( 4 ) propertyIsEnumerable ( propertyname )

( 5 ) toLocaleString ( )

( 6 ) tostring ( )

( 7 ) valueof ( )

More details will be followed by the fifth chapter.

Second, statement

A lot of statements, there are many commonly used statements that don't go together, just remind the label and with statements.

1, label statement

A tagged statement is generally used with a for loop statement and is combined with a break or continue, and in es5. No action This is the case.

var num = 0;


for(var i=0; i<10; i++){

 for(var j=0; j<10; j++){

 if(i == 5&& j==5){

 break outmost;






Notice the difference between break outmost and break;

2, with statement

The role of with statements is to set the scope of code to a particular object object, such as

A with ( object ) % %, and all statements inside the parentheses are executed in the context of the object.

Copyright © 2011 Dowemo All rights reserved.    Creative Commons   AboutUs