Suppose i have a object with properties and method.
When i assign this object to another object, and i execute following code. Its giving me undefined undefined output while printing object obj1 in console, can anyone please help me on this, and explain me this behaviour.
thank you.
var emp = {
fname: "sachin",
lname: "pawar",
getname: function() {
return this.fname + " " + this.lname;
}
};
var obj = emp.getname;
var obj1 = obj();
var obj3 = emp.getname();
console.log(obj1);