I have the following code:
class Request {
constructor(method, url) {
this.method = method;
this.url = url;
}
send() {
return fetch(this.url, { method: this.method })
.then((res) => res.json());
}
}
const url = "https://ron-swanson-quotes.herokuapp.com/v2/quotes";
const getQuotes = new Request("get", url);
const all = {
getQuotes
};
getQuotes.send().then(alert);
delete all.getQuotes;
Can somebody, please, explain why does getQuotes.send() resolve even after I have explicitly deleted a class instance on which the promise was executed.