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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:41:50+00:00 2026-05-26T15:41:50+00:00

Maybe silly question to the JS gurus and ninjas out there but here goes:

  • 0

Maybe silly question to the JS gurus and ninjas out there but here goes:

My understanding of the prototype object/property of an object is that it is a blueprint for future instances of an object. Given this, shouldn’t a newly created instance of an object be identical to the constructor object that created it?

var x = new Object(); 
console.log(x === Object.prototype); // returns false. why?? 

* UPDATE *

So understanding that this will return false because they are referencing different things, I still find that new Object() and Object.prototype contain a different number of properties. So to refine my question: How do I correctly check the number of properties in a prototype Object; how do I iterate through them?

The reason I got confused by this is that if I create a simple constructor function:

function Circle(){
   this.tail = "yes, has tail";
}

and want to get the number of properties it has, doing something like:

console.log(Object.getOwnPropertyNames(Circle.prototype)); 
// returns "constructor", I expected it to return "tail"
  • 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-26T15:41:51+00:00Added an answer on May 26, 2026 at 3:41 pm

    === does not answer the question of whether two things are equivalent, but whether they are references to the same object.

    x and Object.prototype in your example may have the same properties, so you can call them equivalent, but they are two different objects.

    If you do

    x.foo = 3
    

    they are now no longer equivalent, because they were two different objects. You changed one but not the other.

    If

    x === Object.prototype
    

    were true, then

    x.foo === Object.prototype.foo
    

    would be the same regardless of what you assign to x.foo or Object.prototype.foo.

    EDIT:

    function Circle(){ this.tail = "yes, has tail"; }
    
    console.log(Object.getOwnPropertyNames(Circle.prototype)); 
    // returns "constructor", I expected it to return "tail"
    

    There is no tail property on Circle.prototype because you have never done Circle.prototype.tail = ...;. You define tail only on Circle instances via this.tail = ...;.

    I still find that new Object() and Object.prototype contain a different number of properties.

    You are also doing getOwnPropertyNames. The own properties are those that are not inherited from the prototype, so by using that function on x you are explicitly excluding all the properties of Object.prototype.

    The docs for hasOwnProperty explain "own property" pretty well:

    This method can be used to determine whether an object has the specified property as a direct property of that object; unlike the in operator, this method does not check down the object’s prototype chain.

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

Sidebar

Related Questions

Ok so this maybe a simple/silly question but I don't know so here goes:
Maybe a silly question but here goes anyway. Example: Let's say I have one
Maybe this is a silly question, but I'm working on a project that wants
Maybe this is a silly question but is there a difference,besides the obvious,between android:text=@string/....
Maybe that's a silly question... But what's the best (performance and memory wise) way
Maybe my question is silly but there's one thing I wish to know about
It this possible? How? (Maybe silly question, but I couldn't find answer :( )
I downloaded their emoticons and it is a silly question maybe but can I
Maybe the question sounds silly, but I don't understand 'something about threads and locking
Maybe this question is kind of silly but I have no clue how to

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.