Just wondering, having the following simple code:
var object1 = {
name: function (){
return 'myName';
},
surname: function (){
return 'mySurname';
}
};
Why does JS returns function()
in this case object1.name ?
Why does JS returns the expected result myName
if I call object1.name() ?