Suppose this is my object
// Object Literal
var personObjLit = {
firstname : "John",
lastname: "Doe",
greetFullName : function() {
return "personObjLit says: Hello " + this.firstname +
", " + this.lastname;
}
}
I want to call greetFullName
method, I can call it using two methods.
var personFullName = personObjLit.greetFullName();
var personObjLitObject = Object.create(personObjLit);
I want to know what is the difference between these two. I mean it just the different approaches or it affects memory or something else.