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 5998587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:25:39+00:00 2026-05-23T00:25:39+00:00

I read an article which explains what prototype chain is. It says that if

  • 0

I read an article which explains what prototype chain is.

It says that if I try to access an object’s property but it doesn’t have it, javascript engine will try it’s .constructor.propotype. If it doesn’t have it either then try .construtor.propotype.constructor.propotype. Untill it find the built-in Object().

But I test this:

function a() {}
b = new a();

then:

c = b.constructor.prototype

I get an empty a object.

then:

d = c.constructor.prototype

I get an empty a object.

It loops. No matter how many .constructor.prototype I call, it can’t find Object(). What’s wrong? Do I misunderstand the prototype chain?

  • 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-23T00:25:40+00:00Added an answer on May 23, 2026 at 12:25 am

    In JS OOP the constructor and prototype properties are flaky, in that they aren’t set for you when you perform inheritance. You are supposed to manually set/alter them to implement inheritance. See, for example, this tutorial.

    It looks like the way you’re trying to climb the prototype chain (by traversing through .constructor.prototype) never really reaches the Object top-level prototype, since when you have function a(){} the right constructor and prototype properties aren’t set on a. I can’t even manage to coerce them onto a; in Chrome I get:

    > function a(){}
    undefined
    > a.constructor.prototype
    function Empty() {}
    > a.constructor.prototype = Object.prototype
    Object
    > a.constructor.prototype
    function Empty() {} // hmmmm, the assignment didn't take...
    

    Of course the runtime doesn’t need to do this, since it has a reference to the actual prototype of each object. I.e. the language doesn’t do the lookup via .constructor.prototype, it saves the prototype of each instance internally. So you can see how the lookup chain works if instead of .constructor.prototype you use .__proto__:

    function a(){}
    b = new a();
    b.__proto__ === Object.prototype; // false
    b.__proto__.__proto__ === Object.prototype; // true since we reached the top of the prototype chain
    

    It is important to note that the property __proto__ has never been standard and in ES5 was standardised in a slightly different manner:

    obj.__proto__ === Object.getPrototypeOf(obj);
    

    This renders .__proto__ deprecated.

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

Sidebar

Related Questions

I have read from some article that say's Apple doesn't approve the application which
I have code that is logging Exception.Message . However, I read an article which
My friend read an article which mentioned that moving all JavaScript files to the
I read in an article which says : It is a common practice to
i have an article document, for which i keep track of the read count.
I have read article at https://developer.mozilla.org/en/DOM/element.addEventListener but unable to understand useCapture attribute. Definition there
I read an article entitled Tags First GWT , in which the writer suggests
I read this article which is about Managing heap memory written by Randy Kath.
I just read an article which states: Internet domain addresses opened up to wave
I am learning about REST and PUT/DELETE, I have read that both of those

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.