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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:20:04+00:00 2026-06-12T04:20:04+00:00

It is often said that every Javascript object has a prototype property, but I

  • 0

It is often said that every Javascript object has a prototype property, but I find that foo.prototype has a value only if foo is a function.

On Chrome and Firefox, obj.__proto__ has a value — is this the said prototype property? But on IE 9, it won’t work (is there some way that can?), and I thought by prototype property, that means obj.prototype should work?

I understand that Object.getPrototypeOf(obj) seems to show this prototype property, but why need a special method to get it? Why not just like person.name, which is to get the name property of the person object?


Update: by the way, obj.constructor.prototype seems to sometimes be that prototype, but sometimes not, as in the following code done with Prototypal inheritance with no constructor: (this method is in the Pro Javascript Design Patterns book by Harmes and Diaz by Apress 2008, p. 46)

var Person = {
    name: 'default value',
    getName: function() {
        return this.name;
    }
}

var reader = clone(Person);
console.log(reader.getName());
reader.name = "Ang Lee";
console.log(reader.getName());

function clone(obj) {
    function F() {};
    F.prototype = obj;
    return new F;
}

console.log("the prototype of reader is", Object.getPrototypeOf(reader));

console.log(Object.getPrototypeOf(reader) === reader.constructor.prototype);
console.log(Object.getPrototypeOf(reader) == reader.constructor.prototype);

console.log(Object.getPrototypeOf(reader) === reader.__proto__);
console.log(Object.getPrototypeOf(reader) == reader.__proto__);

the result will show false, false, true, true for the last 4 lines.

  • 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-12T04:20:06+00:00Added an answer on June 12, 2026 at 4:20 am

    Every JavaScript object has an internal “prototype” property, often called [[prototype]], which points to the object from which it directly inherits. This is exposed in FF and Chrome by the non-standard __proto__ property. Object.getPrototypeOf is a getter for this internal property.

    Every JavaScript function [object] has a property prototype, which is initialized with an [nearly] empty object. When you create a new instance of this function by calling it as a constructor, the [[prototype]] of that new object will point to the constructor’s prototype object.

    If you get the [[prototype]] of a function (every function is an object, so it has one), it will result in the Function.prototype object from which functions inherit their methods (like bind, call, apply etc). See also Why functions prototype is chained repeatedly? on that.

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

Sidebar

Related Questions

I often see something like that: something.property|escape something is an object, property is it's
It is often said that in C++11 it is sane to return std::vector by
It is often said that, you should not rebase commits that you have already
Note that I'm asking about something that will call a callback function more often
I come from a python background, where it's often said that it's easier to
I was often said that rule : HTML is static ; in other words
Possible Duplicate: What is a translation unit in C++ It is often said that
I often find myself wanting to change just something little in a colorscheme, but
It's often said that one shouldn't use C standard I/O functions (like fprintf() ,
It is often said when unit testing to dont test the database as that

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.