Nanyi Teacher JavaScript Course study notes

Source: Internet
Author: User
Tags script tag domain server

1, switch uses the strict equality operator 2, break and continue have jump action, break statement out of the loop, continue used to immediately terminate this round cycle, return to the head of the loop structure, the next round to start the Cycle. 3. All the figures inside JavaScript are stored as 64-bit floating-point numbers, and the operations and comparisons involving decimals require special care. (-1) ^ Sign bit * 1.xx...xx * 2^ digit 4, nan is a special value for javascript, which means "not a number", which is mainly seen when parsing a string into a numeric error. Nan is not equal to any value, including itself. 5. Different variable names point to the same object, so they are all references to this object, which means pointing to the same memory address. Modifying one of the variables affects all other Variables. The data for the original type is a value reference, which means that it is a copy of the Value. 6. The WITH statement is useful when manipulating multiple properties of the same object. The With block does not change scope, and its interior remains the current Scope. With (object) {statement;} because a variable that cannot be manipulated is a property of object or a global variable, it is not conducive to the debugging and modularization of the Code. The with binding object is Ambiguous. Using this feature, the template engine can be implemented. 7. The typical Array-like object is the arguments object of the function, and most of the DOM element set, as well as the String. 8, The function itself is a value, also has its own scope. Its scope is the same as a variable, which is the scope of its declaration, regardless of the scope of its runtime. A function declaration is a function that is declared inside a function body without a semicolon, within the scope binding function Body. 9, It is important to note that the length property of the function is independent of the number of arguments actually passed in, reflecting only the number of arguments the function expects to pass IN. 10, If the function is the original data type (numeric, string, boolean), the way to pass is the value of the PASS. This means that the parameter values are modified inside the function body without affecting the outside of the Function. If it is a parameter of a composite type (array, object, other function), the pass-through is a pass-through. That is, the address of the original value of the function is passed in, so modifying the parameter inside the function affects the original Value. 11, closure of the maximum use of two, one can read the variables inside the function, and the other is to keep these variables in memory, that is, closures can make it the birth of the environment has been there. Closures allow internal variables to remember the result of the last Call. Another use of closures is to encapsulate the Object's private properties and private methods. 12. Inside the JavaScript engine, eval is actually a reference, and an internal method is called by Default. This allows for the use of eval in two cases, one for direct invocation, the scope for the current scope, and, in addition to the calling method, called "indirect invocation", at which time the global scope of the scope of Eval is Scoped. 13, self-increment and decrement operators have a need to pay attention to, that is, after the variable, will return the value before the operation of the variable, and then Self-increment self-reduction operation, before the variable, the self-increment, the self-subtraction operation, and then return the value after the variable Operation. 14. All constructors have a prototype property that points to a prototype Object. All properties and methods defined on the Object.prototype object will be shared by all instance Objects. Http://www.ruanyifeng.com/blog/2011/06/designing_ideas_of_inheritance_mechanism_in_javascript.html  A detailed explanation of the inheritance of the prototype Chain.  
15, the array method summary. (a), push, pop, shift, unshift are all part of adding or deleting elements before and after the array, so expect to change the original array. (b), slice, splice, reverse, sort arrays are cut, reversed, or sorted, so the original array is expected to Change. (c), map, reduced, Filter Functional Programming in the method of the array, used to generate a new array, so the original array will not be changed.
(d), when a loop is required to terminate, use for, do not need to terminate the loop, use Foreach.
(e), concat, and Jion are used for merging multiple arrays, so the original array remains unchanged.
16, JavaScript Design Wrapper object The biggest goal, the first is to make JavaScript "object" covers all Values. second, the value of the primitive type makes it easy to invoke a particular method. 17. Regular Expressions: related methods for regular expression objects: regex.test (String): The test method of a regular expression returns a Boolean value that indicates whether the current pattern matches the argument String. Regex.exec (String): The Exec method of the regular object, which can return a matching Result. If a match is found to return an array, the member is the string for each successful match, otherwise null is Returned. Related regular methods for string objects: String.math (Regex): returns an array whose members are all matching substrings. String.search (Regex): searches by a given regular expression, returns an Integer that represents where the match Started.
String.Replace (Regex): Replace with the given regular expression, returning the replaced String.
String.Split (Regex): string splitting by a given rule, returning an array containing the individual members after the Split.
18. JavaScript provides an internal data structure that describes the behavior of an Object's properties and controls its Behavior. These become "attribute descriptor objects". Each property has its own corresponding property description object, which holds some meta information for that Property. 19. Create an instance flow with the new command: a, create an empty object, as an instance object to return, b, prototype the empty object, point to the prototype attribute C of the function object, assign the empty object to the This keyword inside the function d, start executing the code inside the constructor 20, The use of this can be divided into the following occasions: 1, Global environment  2, Constructor  3, Object method 21, function instance of the call method, you can specify the function of the internal this point (that is, the scope of function execution), and then in the specified scope, Call the Function. One application of the call method is to invoke the native method of the Object. 22. Apply and call the first parameter is the object to which this is directed, and if set to null or undefined, it is equivalent to specifying a global object. The argument for apply is an array. 23, some of the properties of the object itself, can be enumerated, and some can not be enumerated. The Object.getownpropertynames method returns all key Names. Get only those attributes that can be enumerated, using the Object.keys method. 24, all the tasks can be divided into two kinds, one is synchronous task, the other is asynchronous Task. A synchronization task is a task that is queued on the JavaScript execution process to perform the latter task only if the previous task is completed, and the asynchronous task is a task that does not go into the JavaScript execution process but instead goes into the task queue, only the task queue Notifies the main process that an asynchronous task can be executed, and the task (in the form of a callback Function) is entered into the JavaScript process Execution. 25. the smallest constituent unit of the DOM is the Node. The Document's tree structure (dom Tree) is made up of a variety of different types of nodes, with 7 types of Nodes. Document, documenttype, Element, Attribute, Text, Comment, DocumentFragment26, The rendering engine handles pages in four Stages: 1. Parse the code, parsing the HTML code into DOM,CSS code parsing to cssom;2. object composition, combining the DOM tree and Cssom tree into a render tree 3. Layout: calculates the layout of the render Tree 4. Draw: Draw the render tree to the screen   27, finite state machine is a very useful model, can simulate most things in the WORLD. 1. The total number of states is limited; 2. at any one time, only in one State 3. Some kind of articleChange from one state to Another.
28. When a function is not a property of an object, it is called as a function, which is bound to the global object when the function is called in this Mode.
29, the implementation of Wen cross-domain: 1) the same domain security policy cors, the server that requires regular storage of resources in the response header to add Access-control-allow-origin tags, allowing the specified site to access the resources of the current Site. -----service-side Support 2) H5 solution: message communication is implemented through different pages. 3) WebSocket is a new protocol for H5 that enables Full-duplex communication between the server and the browser, while also allowing Cross-domain Communication. 4) JSONP, The main use of the script tag is not subject to the Same-origin policy restrictions, the Cross-domain server request and return a piece of JSON Data.
30. There are two main types of JavaScript module specification: commonjs and Amd,1) define modules: according to the COMMONJS specification, a single file is a Module. Each module is a separate scope, meaning that variables defined inside the module cannot be read by other modules unless they are defined as properties of the global Object. 2) Module Output: The module has only one exit, module.exports object, we need to put the content that the module wants to output into the Object. 3) load module: The load module uses the Require method, which reads a file and executes it, returning the Module.exports object inside the File.
31, the difference between AMD and Cmd: 1) AMD is highly dependent on the predecessor, when defining the module, declare its dependent module 2) cmd to respect the nearest dependency, only when the use of a module to Require.
32.


From for Notes (Wiz)

Nanyi Teacher JavaScript Course study 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.