10

Understanding the Difference Between Object.create and New Operator

 3 years ago
source link: https://hackernoon.com/understanding-the-difference-between-objectcreate-and-new-operator-vfr37ab
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

@vaibhavsilarVaibhav Silar

writing simple code is most challenging task

Most of us must have seen object creation using two methods, Object.create and new operator). But some of you must have wondered what the difference is between the two methods. Let's dive into the them and outline the differences.

0 reactions

Consider the below code snippet.

0 reactions
function Animal()
{
 this.name = null;
}

Animal.prototype.getName = function()
{
 return this.name;
}

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK