this Keyword in Different Contexts
What issue exists with 'this' in the Promise chain?
const api = {
baseURL: 'https://api.example.com',
fetch() {
return Promise.resolve().then(function() {
return this.baseURL;
});
}
};
const api = {
baseURL: 'https://api.example.com',
fetch() {
return Promise.resolve().then(function() {
return this.baseURL;
});
}
};