这一直让我发疯!这是我第一次使用设置器和获取器,我很难过。
var Person = function () {
var address = setPersonAddress();
this.setPersonAddress = function (a.getFullAddress()) {
address = a.getFullAddress();
};
};
var Address = function () {
var address = "xyz";
var city = "xyz";
var state = "NY";
var zip = "56783";
this.fullAddress = function () {
var name = address + ", " + city + ", " + state + ", " + zip;
return name;
};
this.getFullAddress = function () {
return fullAddress();
};
};
var a = new Address();
我正在尝试将地址对象中的 fullAddress 分配给 Person 对象地址。我在 setPersonAddress 中正确引用 getFullAddress 吗?