Object.create
object create
2023-09-14 08:57:46 时间
var emptyObject = Object.create(null);
var emptyObject = Object.create(null);
var emptyObject = {};
var emptyObject = new Object();
区别:
var o; // create an object with null as prototype o = Object.create(null); o = {}; // is equivalent to: o = Object.create(Object.prototype); function Constructor(){} o = new Constructor(); // is equivalent to: o = Object.create(Constructor.prototype); // Of course, if there is actual initialization code in the Constructor function, the Object.create cannot reflect it // create a new object whose prototype is a new, empty object // and a adding single property 'p', with value 42 o = Object.create({}, { p: { value: 42 } }) // by default properties ARE NOT writable, enumerable or configurable: o.p = 24 o.p //42 o.q = 12 for (var prop in o) { console.log(prop) } //"q" delete o.p //false //to specify an ES3 property o2 = Object.create({}, { p: { value: 42, writable: true, enumerable: true, configurable: true } });
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/create
相关文章
- java object toarray,Object[] toArray()
- object finalized_finalize()方法
- ORA-24048: cannot create QUEUE_TABLE, user does not have access to AQ object types ORACLE 报错 故障修复 远程处理
- ORA-24359: OCIDefineObject not invoked for a Object type or Reference ORACLE 报错 故障修复 远程处理
- ORA-28134: object cannot have fine-grained access control policy ORACLE 报错 故障修复 远程处理
- ORA-39083: Object type string failed to create with error: string Failing sql is: string ORACLE 报错 故障修复 远程处理
- MySQL Error number: MY-010030; Symbol: ER_DD_CANT_CREATE_OBJECT_KEY; SQLSTATE: HY000 报错 故障修复 远程处理
- ORA-00064: object is too large to allocate on this O/S (string,string,string) ORACLE 报错 故障修复 远程处理
- ORA-04025: maximum allowed library object lock allocated for stringstringstringstringstring ORACLE 报错 故障修复 远程处理
- MySQL Error number: MY-011744; Symbol: ER_LDAP_AUTH_FAILED_TO_CREATE_LDAP_OBJECT_CREATOR; SQLSTATE: HY000 报错 故障修复 远程处理
- ORA-12839: cannot modify an object in parallel after modifying it ORACLE 报错 故障修复 远程处理
- ORA-13138: could not determine name of object string ORACLE 报错 故障修复 远程处理