Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6011705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:17:53+00:00 2026-05-23T02:17:53+00:00

I understand javascript prototype inheritance through the __proto__ property. However I notice that when

  • 0

I understand javascript prototype inheritance through the __proto__ property. However I notice that when I do var f = function() {} f will now have a prototype property in addition to the __proto__ property. It would seem that prototype does not participate in property chaining. What exactly does it do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T02:17:54+00:00Added an answer on May 23, 2026 at 2:17 am

    It gets assigned as the prototype of objects created by using that function via the new keyword.

    So for instance:

    function Foo() {
    }
    Foo.prototype.bar = 47;
    
    var obj = new Foo();
    alert(obj.bar); // alerts 47, via `obj`'s prototype
    

    The reference between obj and the object assigned to Foo.prototype is a live one, and so adding further things to Foo.prototype will make them show up on obj‘s prototype:

    Foo.prototype.charlie = 62;
    alert(obj.charlie); // alerts 62
    

    Naturally, if you replace Foo.prototype (which I discourage), then you’re pointing Foo.prototype at a different object. obj will still refer to the old one:

    Foo.prototype = {delta: 77}; // Not recommended
    alert(obj.delta); // alerts "undefined"
    

    Gratuitous live example

    Regarding __proto__: __proto__ is non-standard. Prior to ECMAScript5 (which is just a year and a half old), there was no standard way to interact directly with an object’s prototype, you could only assign them at object creation time, and only indirectly via a constructor function’s prototype property. __proto__ is a proprietary extension in some JavaScript engines (most notably Mozilla’s SpiderMonkey, the engine in Firefox). It’s not in any standard, and according to the ECMAScript committee, it won’t be. (Instead, ECMAScript5 provides functions for interacting with an object’s prototype.) __proto__ is now deprecated by Mozilla.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Which algorithm does the JavaScript Array#sort() function use? I understand that it can take
I was experimenting with inheritance in javascript, and wrote those two functions: Object.prototype.inherits=function(obj){this.prototype=new obj;}
I have a javascript function: string.prototype.startsWith = function(str) { return (this.indexOf(str) === 0); }
I'm creating a JavaScript class (using Prototype) that will set the page state to
We have a website that uses javascript, prototype for client scripting, We are starting
I understand that in JavaScript you can write: if (A && B) { do
I understand that Firefox addins can be created in Javascript and Chrome. How do
I came across this JavaScript function and I don't understand quite what it's doing,
Today I saw a JavaScript syntax (when invoking a function) that is unfamiliar to
I understand that jQuery is the preferred Javascript framework for Firefox extensions, but I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.