In-depth analysis of JavaScript Object System-2. Function objects

Source: Internet
Author: User
2. function object @ Wu Qiong Adam (Sina Weibo) The function object is first an object. Therefore, it also has the _ proto _ link and Delegation. Another special feature of a function object is that it has an attribute called prototype (prototype ?,... SyntaxHighli

2. Function Object)

 

@ Wu Qiong Adam (Sina Weibo)

 

Function objects are first an object. Therefore, they also have _ proto _ links and Delegation. Another special feature of a function object is that it has an attribute called prototype (prototype ?, Yes, I have always used the _ proto _ link to represent the prototype linkage mentioned above, so as to avoid confusion ).

 

When a function is defined using var ff = Function () {}, JS generates a function object whose _ proto _ Pointer Points to the Function. prototype also has a property attribute whose value is an object. Only one property of this object is the constructor. The constructor value is the defined function () {} of this function (){}, the _ proto _ pointer of this Object points to the Object. prototype, for example:

 

After learning about the function object, let's see how it works: When a function is activated with new, a new object will be created, and its content is the returned result of executing the function, the _ proto _ link of this object points to the prototype attribute object of the function, as shown in the following example:

Abstract:



From column adwu73

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.