So I am trying to learn functional programming and I see that when I return
const profile = {
name: 'qw',
children: [{
name: 'peter',
getName() {
return this.name;
}
}],
getName() {
return this.name;
}
};
const val = profile.getName();
console.log(`output is ${val}`); //I get 'qw' as expected
//However if I try
const val1 = profile.getName;
console.log(`output is ${val1()}`); //I get ''
I am not sure why this is returning different things on not using '()'