Object.create() JavaScript

The Javascript Object create() method creates a new object with the specified prototype object and properties.

Syntax:

Object.create(prototype[, propertiesObj])

Parameters:
prototype: It represents the target object. It is required parameter.
propertiesObj: It represents enumerable properties which will be added on newly created object. It is optional parameter.

Return:
New object with the specified prototype object and properties.

Example:

<!DOCTYPE html>
<html>
<body>
<script>
function jewels() { this.name = 'DIAMOND';  }  
function gems() {  jewels.call(this)   }  
gems.prototype = Object.create(jewels.prototype);  
const select = new gems();  
document.write(select.name);    
</script>
</body>
</html>

Output:

DIAMOND
Please Share