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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:12:00+00:00 2026-06-08T14:12:00+00:00

Possible Duplicate: How does JavaScript .prototype work? Coming from Java background, I’m trying to

  • 0

Possible Duplicate:
How does JavaScript .prototype work?

Coming from Java background, I’m trying to understand javascript.

Please let me know if these are right.

  1. Like in java, there is a supreme Object, from which all other objects inherit.
  2. The prototype property is like a pointer that points to the parent object (classes in java)
  3. For “Object” object, the prototype is null.
  4. prototype property’s values are strings denoting the objects nomenclature and aren’t pointers like in C. The pointer concept is implemented using the hidden attribute,[[PROTOTYPE]] that is not accessible in script.

I’m using node.js instead of browser to learn JS.
I tried,

var human = Object.create(null);  // same as var human;
console.log(Object.getPrototypeOf(human)); //null

var man  = Object.create(human);
console.log(Object.getPrototypeOf(man));
//{}
//expected 'human'

var person = Object.create(Object.prototype); // same as var person = {}
console.log(Object.getPrototypeOf(person));
//{}
//expected 'object'
  • 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-08T14:12:06+00:00Added an answer on June 8, 2026 at 2:12 pm
    1. Yes, with the exception of Object.create(null) which doesn’t inherit from anything.
    2. Not sure what “parent object” is, but the prototype of a function consists of functions that are accessible by instances. Because Object.prototype.toString exists, so does {}.toString – it is inherited.
    3. Yes, the prototype chain ends here.
    4. No, .prototype (or the value returned by Object.getPrototypeOf) is an object which you can extend with properties, so that those properties are inherited by instances.

    Your examples:

    var human = Object.create(null);  // same as var human;
    

    No, it creates an empty object that doesn’t inherit from anything. var human; sets human to undefined – which is not an object but a primitive value (not everything is an object in JavaScript).

    var man  = Object.create(human);
    console.log(Object.getPrototypeOf(man));
    //{}
    //expected 'human'
    

    Object.getPrototypeOf(man) returns the object human. This is an empty object; node shows it as {}. It is not a string. In fact, objects can be assigned to multiple variables. An object does not have a variable bound to it, so by design it is not possible at all to get a string. To check equality, you could do Object.getPrototypeOf(man) === human which yields true.

    var person = Object.create(Object.prototype); // same as var person = {}
    console.log(Object.getPrototypeOf(person));
    //{}
    //expected 'object'
    

    This is indeed the same as {} – an empty object that inherits directly from Object. As said above, the prototype is Object.prototype and not a string. It looks empty but that’s because Object.prototype‘s functions are available by default and hidden.

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

Sidebar

Related Questions

Possible Duplicate: How does JavaScript .prototype work? What is the use of prototype property
Possible Duplicate: How does this CSS triangle shape work? Please help me i need
Possible Duplicate: How does a JavaScript parser work? How do browsers compile Javascript scripts?
Possible Duplicate: Does HTML5 require clients to support JavaScript? Would HTML5 API's work when
Possible Duplicate: What does this mean? (function (x,y)){…}){a,b); in JavaScript Please anyone explain and
Possible Duplicate: JavaScript: why does parseInt(1/0, 19) return 18? Why does parseInt(1/0, 19) evaluate
Possible Duplicate: JavaScript === vs == : Does it matter which “equal” operator I
Possible Duplicate: JavaScript BlockStatement confusion Why does {10 + '1'} + 10 equal 10?
Possible Duplicate: JavaScript losing “this” object reference with private/public properties Why does the second
Possible Duplicate: Why does the background of TextView change it's size? I have 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.