Understanding the Difference Between Object.create and New Operatorby@vaibhavsilar
2,945 reads
2,945 reads

Understanding the Difference Between Object.create and New Operator

by Vaibhav Silar2mAugust 23rd, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Object.create and new operator are different methods used in Javascript. Object.prototype is created in an object and is assigned to its own property. Object.create creates an object having its own properties defined as a second property. New operator creates an empty object and runs Animal constructor in newly created object context. Animal.prototype.getName = function ( ) { this.name = null ; } Animal.prototype.prototype.getName;. Animal. constructor will run so whatever script is written in Animal constructor will. run. Object object is stored in Animal.call(obj)
featured image - Understanding the Difference Between Object.create and New Operator
Vaibhav Silar HackerNoon profile picture
Vaibhav Silar

Vaibhav Silar

@vaibhavsilar

writing simple code is the most complex task

Learn More
LEARN MORE ABOUT @VAIBHAVSILAR'S
EXPERTISE AND PLACE ON THE INTERNET.

Share Your Thoughts

About Author

Vaibhav Silar HackerNoon profile picture
Vaibhav Silar@vaibhavsilar
writing simple code is the most complex task

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite
L O A D I N G
. . . comments & more!