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

  • Home
  • SEARCH
  • 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 6652369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:07:46+00:00 2026-05-26T01:07:46+00:00

It is well-known that declaring objects with JSON notation makes them inherit from (or,

  • 0

It is well-known that declaring objects with JSON notation makes them “inherit” from (or, more precisely, to be built like) the base Object:

myobj={a:1, b:2};

which is nearly equivalent to myobj = Object.create(Object); myobj.a=1; myobj.b=2;

and than:

Object.getPrototypeOf(myobj)

prints the following:

Object
    __defineGetter__: function __defineGetter__() { [native code] }
    __defineSetter__: function __defineSetter__() { [native code] }
    __lookupGetter__: function __lookupGetter__() { [native code] }
    __lookupSetter__: function __lookupSetter__() { [native code] }
    constructor: function Object() { [native code] }
    hasOwnProperty: function hasOwnProperty() { [native code] }
    isPrototypeOf: function isPrototypeOf() { [native code] }
    propertyIsEnumerable: function propertyIsEnumerable() { [native code] }
    toLocaleString: function toLocaleString() { [native code] }
    toString: function toString() { [native code] }
    valueOf: function valueOf() { [native code] }

However, one can call Object.create() while supplying null as an argument:

myobj2 = Object.create(null);

In this case empty prototype will be returned:

Object
    No Properties

And here goes the question: in which cases and why should I care to break the prototype chain to the original Object? Where it can be useful?

Update: as already corrected down below, I mean Object.create(Object.prototype) rather than Object.create(Object) that would return Function object (indeed Object() is a constructor function for Object prototypees).

  • 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-26T01:07:47+00:00Added an answer on May 26, 2026 at 1:07 am

    Instead of this:

    myobj = Object.create(Object);
    

    …I think you mean this is the equivalent:

    myobj = Object.create(Object.prototype);
    

    …because:

    Object.getPrototypeOf( {a:1, b:2} ) === Object.prototype;  // true
    

    As to why to use null early, if your object has no need for any of the properties of Object.prototype, ending the chain early would technically (though marginally) speed up property lookups when a property does not exist on the object in question.

    Note that I say “early” because the chain always ends with null.

    Object.getPrototypeOf( Object.prototype );  // null
    

    
                 obj ----------> proto -------> Object.proto -----> null
             +---------+      +---------+      +-------------+     
             |         |      |         |      |             |
             |  foo:1  |      |  bar:1  |      | toString:fn |      null
             |         |      |         |      |             |
             +---------+      +---------+      +-------------+ 
                  ^                ^                  ^               X
                  |                |                  |               |
    obj.foo ------+                |                  |               |
                  ^                |                  |               |
    obj.bar-------+----------------+                  |               |
                  ^                ^                  |               |
    obj.toString--+----------------+------------------+               |
                  ^                ^                  ^               |
    obj.baz-------+----------------+------------------+---------------+
    
       ^---property lookups
    

    Notice that the baz property does not exist anywhere in the prototype chain.

    Because of this, it needs to search each object in sequence until it finally reaches null before it realizes that baz doesn’t exist anywhere.

    If you eliminate the Object.prototype from the chain, it will get to null a little quicker.

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

Sidebar

Related Questions

It is well known that C# class can inherit only from a Single Base
It's totally well known that in order to be able to serialize your objects
It is well-known that you cannot update the UI from any other thread other
It is well-known that monoids are stunningly ubiquitous in programing. They are so ubiquitous
I can't seem to find an answer to this anywhere. It's well known that
Its a well known fact that a static method can work only on static
I am wondering if there are any well-known algorithms that I should be aware
It's a well known fact, that Oracle treats empty strings as null. However, I'm
I find that many high level functions are missing in most well-known javascript libraries
It's well known that Apple does not provide automatic garbage collection on the iPhone

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.