JavaScript Object.create() Method

The Object.create() method is used to create a new object with the specified prototype object and properties. We can create an object without a prototype by Object.creates (null).

Syntax:

Parameter

prototype: It is the prototype object from which a new object has to be created.

propertiesObject: It is an optional parameter. It specifies the enumerable properties to be added to the newly created object.

Return

Object.create() returns a new object with the specified prototype object and properties.

Browser Support:

ChromeYes
EdgeYes
FirefoxYes
OperaYes

Example 1

Output:

"My name Marry. Am I human? true"

Example 2

Output:

"franco"

Example 3

Output:

"fruit"
 "Winter"
"Winter"





Latest Courses