我正在尝试在下面的代码中测试两个局部变量language
和translationObj
:
public loadDictionary () {
this.source$ = this.httpService
.get(...)
.map((response) => {
const language = this.lang // this.lang contains a value like 'en_GB';
const translationObj = this.convertStringsToArrays(response.data.translations) // contains an object like {'name' : 'Donald', 'age': '16'};
// other stuff going on here
});
return this.source$;
}
}
language
返回类似'en_GB'的字符串,translationObj
返回键/值对象,如{'name' : 'Donald', 'age': '16'}
我遇到的两个问题......
language
)还是分配给它的值(this.lang
)?