3

If you look in the docs it says that Object.Create():

The Object.create() method creates a new object with the specified prototype object and properties.

I think this is ambiguous, because it doesn't say which prototype property is modified (internal [[Prototype]] or publicly available Prototype all functions have). Should it be fixed in the docs or maybe I'm not aware of the terminology?

7
  • Did you see the examples? I think that's so clear. That you create will be Object.Create( YourAnotherObject.prototype ) Commented Oct 14, 2015 at 9:00
  • it means the prototype of new created object (ie. the return value of this method call) will be set as the given proto argument, in code: var o = Object.create(proto); Object.getPrototypeOf(o) === proto returns true Commented Oct 14, 2015 at 9:02
  • I know that it modifies the internal [[Prototype]]. I'm only asking whether the docs should be corrected. Commented Oct 14, 2015 at 9:05
  • @user4205580 I still can't understand your confusion. Which "prototype property" are you referring to? If you're thinking about Function.prototype, then that is only relevant to the new operator. The create() method does not use it and creates objects with "magic". Commented Oct 14, 2015 at 9:22
  • @billc.cn functions are objects as well + functions have two prototype properties - internal [[Prototype]] and accessible Prototype. Now if the docs says an object is created, it doesn't say if it's a function object or usual object with only one prototype property. Commented Oct 14, 2015 at 9:29

1 Answer 1

1

The wording on MDN may need some improvement, but the ECMAScript 5.1 spec linked at the bottom of that article is very clear.

There's no constructor function or Function.prototype involved here. You can supply any object as the first argument. The prototype of no Function will be modified in the process.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.