JSFiddle - React, Tailwind, and code Playground
HTML
<p>click to clean up array and remove images from dom</p>
JavaScript
var a = [];
a.push(new Image());
a.push(new Image());
a[0].src = "http://www.palm.com/us/assets/images/products/pads/touchpad/overview-introducing-hpwebos.png";
a[1].src = "http://www.palm.com/us/assets/images/products/pads/touchpad/touchpad-accessories-touchstone.png";
document.body.appendChild(a[0]);
document.body.appendChild(a[1]);
function cleanup() {
console.log(a);
document.body.removeChild(a[0]);
document.body.removeChild(a[1]);
console.log("Still have references to them so won't be released yet");
delete a[1];
delete a[0];
console.log(a);
}
document.body.onclick = cleanup;