Im new to javascript. I want to ask you. I have this code:
var fullname = 'David';
var obj = {
fullname: 'Jhon',
prop: {
fullname: 'Angle',
getFullname: function () {
return this.fullname;
}
}
};
console.log(obj.prop.getFullname());
var test = obj.prop.getFullname; console.log(test());
The result is
Angle --> console.log(obj.prop.getFullName());
and
David --> console.log(test());
Can you explain that? why the result is different? Thanks