Difference between proto link and Object.create
javascript, object, prototype
Solution
`__proto__` is nonstandard and won't be supported everywhere. `Object.create` is part of the official spec and should be supported by every environment going forward.
It also is implemented differently in different places.
From Effective Javascript:
Environments differ for example, on the treatment of objects with a null prototype. In some environments, `__proto__` is inherited from Object.prototype, so an object with a null prototype has no special `__proto__` property
Moving forward the accepted way to create objects and implement inheritance is the `Object.create` function, and if you do need to access the prototype, you'll want to use `Object.getPrototypeOf` These functions are standardized and should work the same in all modern environments
Problem
I want to know the difference between `__proto__` and `Object.create` method. Take this example: ``` var ob1 = {a:1}; var ob2 = Object.create(ob1); ob2.__proto__ === ob1; // TRUE ``` This implies Object.create method creates a new object and sets `__proto__` link to the object received as parameter. Why don't we directly use `__proto__` link instead of using create method ?