0
我想从https://developer.mozilla.org/en-US/docs/JavaScript/A_re-introduction_to_JavaScript了解Javascript概念。 请参阅下面的代码;使用相同运算符的Javascript函数和对象
function personFullName() {
return this.first + ' ' + this.last;
}
function personFullNameReversed() {
return this.last + ', ' + this.first;
}
function Person(first, last) {
this.first = first;
this.last = last;
this.fullName = personFullName;
this.fullNameReversed = personFullNameReversed;
}
我很困惑,为什么功能personFullName()被调用像
this.fullName = personFullName;
为什么不叫等;
this.fullName = personFullName();
以下相同;
this.fullNameReversed = personFullNameReversed;
我知道函数是javascript中的对象,但我无法理解这个概念?