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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:01:34+00:00 2026-06-04T21:01:34+00:00

This is the JavaScript code generated by CoffeeScript’s extends keyword. How the prototype chain

  • 0

This is the JavaScript code generated by CoffeeScript’s extends keyword. How the prototype chain gets setup?

var __hasProp = Object.prototype.hasOwnProperty,
__extends = function(child, parent) { 
    for (var key in parent) { 
        if (__hasProp.call(parent, key)) child[key] = parent[key]; 
    } 
    function ctor() { this.constructor = child; } 
    ctor.prototype = parent.prototype; 
    child.prototype = new ctor; 
    child.__super__ = parent.prototype; 
    return child; 
};
  • 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-06-04T21:01:35+00:00Added an answer on June 4, 2026 at 9:01 pm
    var __hasProp = Object.prototype.hasOwnProperty,
    __extends = function(child, parent) {
        // Copy "static" attributes from the parent constructor to the child constructor
        for (var key in parent) { 
            if (__hasProp.call(parent, key)) child[key] = parent[key]; 
        } 
        // This is the surrogate constructor, used so you don't need
        // to instantiate an instance of the parent just to setup the prototype chain
        // the statement in the surrogate constructor properly attaches
        // the constructor property to object
        function ctor() { this.constructor = child; }
        // Attach the parent's prototype to the surrogate constructor
        ctor.prototype = parent.prototype; 
        // This is setting up the chain, attaching an instance of a constructor whose
        // prototype is set to the parent to the prototype property of the child
        // In naive implementations, this would be child.prototype = new parent();
        child.prototype = new ctor; 
        // Allows access to the parent from user code, and used by the `super` keyword
        child.__super__ = parent.prototype; 
        return child; 
    };
    

    See http://js-bits.blogspot.com/2010/08/javascript-inheritance-done-right.html (my own blog post)

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

Sidebar

Related Questions

So, I run this javascript . this code gets the html generated by cart.php
I have this JavaScript code: for (var idx in data) { var row =
How to write this JavaScript code without eval? var typeOfString = eval(typeof + that.modules[modName].varName);
I have this javascript code <Script> function getGroupId(){ var group=document.getElementById(selectedOptions).value; var groupFirstLetter=group.substring(2); } </Script>
If I generate some Javascript in my Scala code like this: <script type=text/javascript> foo({bar});
This javascript code does not work in IE8, but works in Firefox and Google
i have this javascript code to which i want to add the jquery fade-in
I have this javascript code below that uses jquery, it is suppoed to be
I have this JavaScript code that creates a table, and puts in the rows
I currently am using this JavaScript code snippet to select 3 checkboxes at a

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.