Home >Web Front-end >JS Tutorial >Introduction to using Object.create() to create objects in JavaScript_javascript skills
For object creation, in addition to using literals and the new operator, in the ECMAScript 5 standard, you can also use Object.create(). The Object.create() function accepts 2 objects as parameters: the first object is required and represents the prototype of the created object; the second object is optional and is used to define various properties of the created object (for example, writable , enumerable).
Calling Object.create() with null as the first argument will generate an object without a prototype, which will not have any basic Object properties (for example, since there is no toString() method, using operations on this object symbol will throw an exception):
For browsers that only support the ECMAScript 3 standard, you can use Douglas Crockford’s method to perform the Object.create() operation: