Is this a good way to garbage collect
function getFile() {
var xhr = new XMLHttpRequest();
xhr.onload = function() {
//do stuff
delete(xhr)
};
}
and then call getFile()
a couple of times
(I've edited it to use a function)
How would I get rid of xhr
when it's done. I'm just a bit confused on whether its ok to remove xhr from within a function of itself