Xpress distal note (a)

front end

Basic error-prone title (a)

Case :: introduce a prototype js chain inheritance principle, and the difference between the prototype and --proto--!

  1. Any constructor has a property called a constructor function prototype prototype, an object, and the object points to the default case Object instance, points to the current constructor constructor, - proto-- point Object.protopyte.

  2. Use presence constructor instantiated object --proto-- attribute, point current prototype constructor.

  3. When we call the properties and methods of an object instance, the first conducted to find itself above [his body is out of the properties and methods defined by this inside the constructor], if not on top of itself. Then go along --proto-- constructor prototype look above, we look for is called prototypal inheritance along --proto--.

  4. In the search process, the prototype along --proto-- go find your constructor, if found is returned, if no default back to continue the search along --proto-- go above Object.prototype this lookup behavior. We call it "the prototype chain to find." --Proto-- formed along the chain, which we call "the prototype chain to inherit."

 

 

Case II :: js jquery objects and objects What is the difference and how to convert? ?

  js jq objects and the object key-value is an unordered set of key-value pairs,

the difference: 

  1.jq object is a package of native DOM object

  Internal 2.jquery package many useful properties and methods of an object jq

  3.jq object can not go calling native DOM properties and methods

Transformation:

      jq object into DOM object

 1. $ ( "# box") get (0);. $ ( "# Box") is obtained jquery packaged object, which provides methods jquery, not native html object, get (0) to html jquery object to get inside the object associated to the operation of the object properties and methods html.

 2. $(#box)[0];

  Benefits DOM object into an object jq

  1.jq objects many useful methods

  2. Compatibility issues

  3. development efficiency

 

Case III :: talk about $ .extend and $ .fn.extend () to use, and what is the difference! !

 

$ .Extend () method is an extension tool

$ .Fn.extend () This is the prototype jQuery inside the constructor

 

 

Xiao Bian will continue answering questions for everyone! !

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

        

Guess you like

Origin www.cnblogs.com/hudunyu/p/11366951.html