I read a little more about ECMAScript 5 (in a browser using ES5-shim , which, as I know, does not support everything). And just to eliminate any confusion, given that I have this object (stolen from this post ):
var Person = { firstName: null,
Is there any difference between this:
var Employee = Object.create(Person, { id: { value: null, enumerable: true, configurable: true, writable: true } });
And this:
var Employee = Object.create(Person); Employee.id = null;
As I understand it, enumerated, custom, and writable can be set to true when defining a property this way (which will also be backward compatible with legacy JavaScript mechanisms). Am I missing something or can I just omit the descriptors of the detailed properties whenever I want this to be the desired behavior?
source share