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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:01:04+00:00 2026-05-27T01:01:04+00:00

Several days ago,I post a question here about class inheritance Then someone provide a

  • 0

Several days ago,I post a question here about class inheritance

Then someone provide a link– a clever script for class inheritance by John Resig.

Then I try to use this script.

But I found that object created by this script will have a very deep prototype chain.

I use the example in the blog:

var Person = Class.extend({
  init: function(isDancing){
    this.dancing = isDancing;
  },
  dance: function(){
    return this.dancing;
  }
});

var Ninja = Person.extend({
  init: function(){
    this._super( false );
  },
  dance: function(){
    // Call the inherited version of dance()
    return this._super();
  },
  swingSword: function(){
    return true;
  }
});

var n=new Ninja(true);
console.dir(n);

With firebug I found this:
enter image description here

So I wonder does the depth of the prototype chain for an object affect the performance?

It seem there is a Endless loop.

  • 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-27T01:01:05+00:00Added an answer on May 27, 2026 at 1:01 am

    The prototype of a constructor is the same constructor. So yes, you are looking at an endless loop.

    However browsers don’t follow the constructor chain when resolving object’s members, it has an internal pointer (sometimes called __PROTO__ but don’t count on it) which is actually used. A JavaScript engine might also opt to compile to machine code which resolves the possible members in advance so no chain at all exists during actual execution.

    I strongly doubt that you will experience any slow-down at all.

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

Sidebar

Related Questions

Several days ago I had a question about removing index.php from the address bar,
Several days ago I attended a seminar and they were talking about dangerous PHP
I asked several days ago about finding the most deeply nested lists . I
There have been several questions over the past few days about the proper use
I know that cout have buffer several days ago, and when I google it,
Merging in my Mercurial repository is not working like I expected. Several days ago
Small and pretty nasty problem I've seen several days ago, asked to my friend
I started studied MongoDB about 2~3 days ago, and I am feeling pretty happy
Several days before, I raised a question to ask how using the keyword 'volatile'
If I don't use GAE development server for several days then it's database vanishes

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.