JavaScript authoritative Guide Notes

Source: Internet
Author: User

Recently every day to see the details of the JS parts, time is not a lot, so the progress will not be too fast, write a blog to supervise themselves every day to see. Previously unknown details or previously know but did not pay attention to the place will be recorded, so suitable for a certain basis, not suitable for 0 basic novice.  ---------------------------------------------------------during the National Day--------------------------------------------------------- JS in all the numbers are floating point, such as 5/2 is not 2, is 2.5,0/0 for Nan, if you want to implement 5/2=2 can use 5>>2=2
See unknown

In JS, Nan and any value are not equal, including itself, so it is possible to determine if X is Nan can be used x! ==x to judge
See unknown

JS string, numeric and Boolean values are immutable
such as: Var s= "Hello"
S.touppercase ();
Console.log (s)
Output S is hello instead of hello
Because the function returns a new string, it does not change itself.
See 47 Page 3.7

JS Type conversion Table
See page 49.

The objects in JS are never equal, even if all the indexes and property values in the object are equal, the same two separate arrays are never equal
Cause: The object is a reference type, the comparison of the object is a reference comparison, and the same is true when the object is the same reference
Other words
var a ={};
var b=a;
A===b is true at this time.
See page 47 at the bottom

Variable scopes are not restricted by {} Blocks of code, only restricted by function declarations, variables declared in the function body are "advanced" to the top of the function body, meaning that variables defined anywhere within the function body can be used anywhere within the function body, but may not be assigned (if used before the declaration)
See page 57 3.10.1

1. Declared global variables and 2. The difference between the global variables generated by the direct assignment is not declared.
1. Cannot delete with delete
2. You can delete with delete
See page 58 3.10.2
Because a variable declared by the user with Var cannot be deleted with delete
See page 89

. Access and [] access differences
. The access will look directly for the. Property value After
[] Access evaluates the expression in parentheses and then accesses it after it is converted to a string
This feature causes if the attribute name is a reserved word that is alive with spaces and punctuation, or a number (for an array), you must use square brackets
See page 63 at the bottom

Operator-related
See page 66

JS comparison operator, if two operands are compared, one is Nan, then always returns false
See page 77 above

Eval () Effect
1. When you define an alias, Eval is global, and you can use the value of the global variable within the function (even if there is a variable with the same name inside the function)
See 85 page Code Snippet
2. Unknown

function definition
1.var funcname = function () {;} functions definition Expression
2.function funcname () {;} function declaration statement
Difference: 1. As with the Var declaration variable, only the variable declaration is advanced to the top of the scope, but there is no value
2. The whole has been advanced
See page 95 at the bottom

52-54 need to take a closer look

else if is not a true JS statement, it is just a idiom for multiple if/else statements to be joined together.
See page 98

Using the switch scenario
Repeated calculation of expressions in multiple if statements is wasteful when all branches depend on the value of the same expression
See page 99.

The value of the expression following the case in switch and the expression after switch is judged by "= = ="
See page 99.

Default can be placed anywhere within the switch
See page 101.

5.5.4
For/in
I don't know much about this object and variable.
See page 104

Label statement
Similar to C-language Goto, not commonly used, not familiar with the method
See page 106

The different behavior of continue statements in different cyclic bodies
The loop expression at the start of the while judgment
Do/while loop expression at end of judgment
For the self-increment expression, then the loop expression is evaluated
For/in traversal of the next property name
See page 108 5.6.3

Throw up to pass
See page 110 below 5.6.5

Finally execution issues
The finally executes as soon as a portion of the code in the Try statement executes. Even if Return,continue,break is used in a try

Using try/finally to simulate a for loop for the while loop (not perfect)
See page 112 below

With statement
Adding an object to the head of a scope chain is not recommended
See page 113 5.7.1

Debugger
Set Program breakpoints for program debugging (as Acmer)
See page 114 5.7.2

"Use Strict"
Use Strict mode
Strict mode differences (the first three are very important):
1. Prohibit the use of with statements
2. All variables must be declared first
3. The This in the called function (not the method) is undefined
4. When invoking a function via call and apply, this is the first parameter passed in
See page 115 for the rest
--------------------------------------------------------------------------------------------------------------- ------------
See page 118

JavaScript authoritative Guide Notes

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.